﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Windows.Media.Imaging;
using System.Windows.Controls;
using System.Globalization;
using ViCode_LeVi.Configs;
using ViCode_LeVi.Controls.Charts;

namespace ViCode_LeVi.Data
{
    [DataContract]
    public class StepInfo : INotifyPropertyChanged
    {
        [DataMember]
        public string ShortName { get; set; }
        public string ShortName_UPPER
        {
            get
            {
                return ShortName;//.ToUpper(); 
            }
            set
            {
                if (ShortName != value)
                {
                    ShortName = value;
                    SendPropertyChanged("ShortName");
                    SendPropertyChanged("ShortName_UPPER");
                    SendPropertyChanged("MenuText");
                }
            }
        }
        [DataMember]
        public string FullName { get; set; }
        public string FullName_UPPER
        {
            get
            {
                return FullName;//.ToUpper(); 
            }
            set
            {
                if (FullName != value)
                {
                    FullName = value;
                    SendPropertyChanged("FullName");
                    SendPropertyChanged("FullName_UPPER");
                    SendPropertyChanged("MenuText");
                    
                }
            }
        }

        public string MenuText
        {
            get { return ShortName; }
        }
        [DataMember]
        public string Summary_Note { get; set; }

        [DataMember]
        public StepResult Result { get; set; }

        [DataMember]
        public Step_QuestionAnwserStep QuestionAnwserStep { get; set; }

        [DataMember]
        public Step_TaskItemStep TaskItemStep { get; set; }

        [DataMember]
        public Step_Analysis Analysis { get; set; }

        [DataMember]
        public Step_Measurement Measurement { get; set; }

        [DataMember]
        public Step_BalanceAndOthers BalanceAndOthers { get; set; }
        
        [DataMember]
        public Step_RiskManagement RiskManagement { get; set; }

        [DataMember]
        public Step_Budget Budget { get; set; }
        public RootData Root
        {
            get
            {
                return RootData.Intance;
            }
        }
        public bool IsCurrent
        {
            get
            {
                return Root != null && Root.Step_Current == this;
            }
            set
            {
                if (value == true && Root != null)
                {
                    Root.Step_Current = this;
                    SendPropertyChanged("IsCurrent");
                    Root.SendPropertyChanged("Step_Current");
                }
            }
        }
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }

    #region
    [DataContract]
    public class Step_BalanceAndOthers : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public void SendPropertyChanged_All()
        {

        }
        #endregion
        public Step_BalanceAndOthers()
        {
            Balance = new Step_BalanceAndOthers_Balance();
            InvestmentCalculation = new Step_BalanceAndOthers_InvestmentCalculation();
            Trade = new Step_BalanceAndOthers_Trade();
            InvestmentPlan = new Step_BalanceAndOthers_InvestmentPlan();
            LIQUIDITYPLAN = new Step_BalanceAndOthers_LIQUIDITYPLAN();
            PROFIT = new Step_BalanceAndOthers_PROFIT_LOSS_STATEMENT();
            SHEET_STATEMENT = new Step_BalanceAndOthers_Sheet_Statement();
        }
        public void CheckAllPropertiesAndRefine()
        {
            if (Balance == null)
                Balance = new Step_BalanceAndOthers_Balance();
            if (InvestmentCalculation == null)
                InvestmentCalculation = new Step_BalanceAndOthers_InvestmentCalculation();
            if (Trade == null)
                Trade = new Step_BalanceAndOthers_Trade();
            if (Price == null)
                Price = new Step_BalanceAndOthers_Price();
            if (InvestmentPlan == null)
                InvestmentPlan = new Step_BalanceAndOthers_InvestmentPlan();
            if (LIQUIDITYPLAN == null)
                LIQUIDITYPLAN = new Step_BalanceAndOthers_LIQUIDITYPLAN();
            if (PROFIT == null)
                PROFIT = new Step_BalanceAndOthers_PROFIT_LOSS_STATEMENT();
            if (SHEET_STATEMENT == null)
                SHEET_STATEMENT = new Step_BalanceAndOthers_Sheet_Statement();
        }

        [DataMember]
        private Step_BalanceAndOthers_Balance _Balance;
        public Step_BalanceAndOthers_Balance Balance
        {
            get
            {
                if (_Balance == null)
                    _Balance = new Step_BalanceAndOthers_Balance();
                return _Balance;
            }
            set
            {
                if (_Balance != value)
                {
                    _Balance = value;
                    SendPropertyChanged("Balance");
                }
            }
        }

        [DataMember]
        public Step_BalanceAndOthers_InvestmentCalculation InvestmentCalculation { get; set; }
        [DataMember]
        public Step_BalanceAndOthers_Trade Trade { get; set; }
        [DataMember]
        public Step_BalanceAndOthers_Price Price { get; set; }
        [DataMember]
        public Step_BalanceAndOthers_InvestmentPlan InvestmentPlan { get; set; }
        [DataMember]
        public Step_BalanceAndOthers_LIQUIDITYPLAN LIQUIDITYPLAN { get; set; }
        [DataMember]
        public Step_BalanceAndOthers_PROFIT_LOSS_STATEMENT PROFIT { get; set; }
        [DataMember]
        public Step_BalanceAndOthers_Sheet_Statement SHEET_STATEMENT { get; set; }
    }
    [DataContract]
    public class Step_BalanceAndOthers_Balance : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public void SendPropertyChanged_All()
        {

        }
        #endregion
        [DataMember]
        public List<Step_BalanceAndOthers_Balance_Item> Items { get; set; }

        public string CompanyName { get { return ProjectData.Intance.CompanyName; } }
        public string AsPer { get; set; }
        #region Group
        public Step_BalanceAndOthers_Balance_Item[] Items_KHACHHANG
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_Balance_Item[0] : Items.Where(c => c.GroupName == GROUP_KHACHHANG_NAME).ToArray();
            }
            set { }
        }
        public Step_BalanceAndOthers_Balance_Item[] Items_SANXUAT
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_Balance_Item[0] : Items.Where(c => c.GroupName == GROUP_SANXUAT_NAME).ToArray();
            }
            set { }
        }
        public Step_BalanceAndOthers_Balance_Item[] Items_NHANVIEN
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_Balance_Item[0] : Items.Where(c => c.GroupName == GROUP_NHANVIEN_NAME).ToArray();
            }
            set { }
        }
        public Step_BalanceAndOthers_Balance_Item[] Items_TAICHINH
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_Balance_Item[0] : Items.Where(c => c.GroupName == GROUP_TAICHINH_NAME).ToArray();
            }
            set { }
        }
        #endregion

        #region Add
        public void AddNew(string group)
        {
            Step_BalanceAndOthers_Balance_Item newItem = new Step_BalanceAndOthers_Balance_Item()
            {
                GroupName = group,
                ChiuTrachNhiem = string.Empty,
                MucTieu = string.Empty,
                NhanXet = string.Empty,
                TinhHinh = new StepResult() { Item = StepResult.StepResultItem_None }
            };
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_Balance_Item>();
            Items.Add(newItem);
        }
        public void Remove(Step_BalanceAndOthers_Balance_Item removeItem)
        {
            var grps = this.Items.Where(c => c.GroupName == removeItem.GroupName);
            if (grps.Count() == 1)
            {
                removeItem.MucTieu = string.Empty;
                removeItem.NhanXet = string.Empty;
                removeItem.TinhHinh = new StepResult() { Item = StepResult.StepResultItem_None };
            }
            else
            {
                this.Items.Remove(removeItem);
            }
        }
        #endregion

        #region UI
        #region Step_BalanceAndOthers_Balance_Header
        [DataMember]
        string _Step_BalanceAndOthers_Balance_Header = string.Empty;
        public string Step_BalanceAndOthers_Balance_Header
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_Balance_Header))
                {
                    _Step_BalanceAndOthers_Balance_Header = "Cockpit BSC";
                }
                return _Step_BalanceAndOthers_Balance_Header;
            }
            set
            {
                if (_Step_BalanceAndOthers_Balance_Header != value)
                {
                    _Step_BalanceAndOthers_Balance_Header = value;
                    SendPropertyChanged("Step_BalanceAndOthers_Balance_Header");
                }
            }
        }
        #endregion

        #region AsPer_UIText
        [DataMember]
        string _AsPer_UIText = string.Empty;
        public string AsPer_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_AsPer_UIText))
                    _AsPer_UIText = "as per:";
                return _AsPer_UIText;
            }
            set
            {
                if (_AsPer_UIText != value)
                {
                    _AsPer_UIText = value;
                    SendPropertyChanged("AsPer_UIText");
                }
            }
        }
        #endregion

        #region Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME
        [DataMember]
        string _Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME = string.Empty;
        public string Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME))
                {
                    _Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME = GROUP_KHACHHANG_NAME;
                }
                return _Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME;
            }
            set
            {
                if (_Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME != value)
                {
                    _Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME = value;
                    SendPropertyChanged("Step_BalanceAndOthers_Balance_GROUP_KHACHHANG_NAME");
                }
            }
        }
        #endregion

        #region Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME
        [DataMember]
        string _Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME = string.Empty;
        public string Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME))
                {
                    _Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME = GROUP_SANXUAT_NAME;
                }
                return _Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME;
            }
            set
            {
                if (_Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME != value)
                {
                    _Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME = value;
                    SendPropertyChanged("Step_BalanceAndOthers_Balance_GROUP_SANXUAT_NAME");
                }
            }
        }
        #endregion

        #region Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME
        [DataMember]
        string _Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME = string.Empty;
        public string Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME))
                {
                    _Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME = GROUP_NHANVIEN_NAME;
                }
                return _Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME;
            }
            set
            {
                if (_Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME != value)
                {
                    _Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME = value;
                    SendPropertyChanged("Step_BalanceAndOthers_Balance_GROUP_NHANVIEN_NAME");
                }
            }
        }
        #endregion

        #region Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME
        [DataMember]
        string _Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME = string.Empty;
        public string Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME))
                {
                    _Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME = GROUP_TAICHINH_NAME;
                }
                return _Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME;
            }
            set
            {
                if (_Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME != value)
                {
                    _Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME = value;
                    SendPropertyChanged("Step_BalanceAndOthers_Balance_GROUP_TAICHINH_NAME");
                }
            }
        }
        #endregion
        #endregion

        #region UI
        #region Title_UIText
        [DataMember]
        string _Title_UIText = string.Empty;
        public string Title_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_Title_UIText))
                    _Title_UIText = "Cockpit BSC";
                return _Title_UIText;
            }
            set
            {
                if (_Title_UIText != value)
                {
                    _Title_UIText = value;
                    SendPropertyChanged("Title_UIText");
                }
            }
        }
        #endregion

        #region MucTieu_UIText
        [DataMember]
        string _MucTieu_UIText = string.Empty;
        public string MucTieu_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_MucTieu_UIText))
                    _MucTieu_UIText = "Objectives";
                return _MucTieu_UIText;
            }
            set
            {
                if (_MucTieu_UIText != value)
                {
                    _MucTieu_UIText = value;
                    SendPropertyChanged("MucTieu_UIText");
                }
            }
        }
        #endregion

        #region TinhHinh_UIText
        [DataMember]
        string _TinhHinh_UIText = string.Empty;
        public string TinhHinh_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_TinhHinh_UIText))
                    _TinhHinh_UIText = "Status";
                return _TinhHinh_UIText;
            }
            set
            {
                if (_TinhHinh_UIText != value)
                {
                    _TinhHinh_UIText = value;
                    SendPropertyChanged("TinhHinh_UIText");
                }
            }
        }
        #endregion

        #region NhanXet_UIText
        [DataMember]
        string _NhanXet_UIText = string.Empty;
        public string NhanXet_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_NhanXet_UIText))
                    _NhanXet_UIText = "Remarks";
                return _NhanXet_UIText;
            }
            set
            {
                if (_NhanXet_UIText != value)
                {
                    _NhanXet_UIText = value;
                    SendPropertyChanged("NhanXet_UIText");
                }
            }
        }
        #endregion

        #region ChiuTrachNhiem_UIText
        [DataMember]
        string _ChiuTrachNhiem_UIText = string.Empty;
        public string ChiuTrachNhiem_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_ChiuTrachNhiem_UIText))
                    _ChiuTrachNhiem_UIText = "Responsible";
                return _ChiuTrachNhiem_UIText;
            }
            set
            {
                if (_ChiuTrachNhiem_UIText != value)
                {
                    _ChiuTrachNhiem_UIText = value;
                    SendPropertyChanged("ChiuTrachNhiem_UIText");
                }
            }
        }
        #endregion
        #endregion

        public string GROUP_KHACHHANG_NAME
        {
            get { return "Client"; }
        }
        public string GROUP_SANXUAT_NAME
        {
            get { return "Production"; }
        }
        public string GROUP_NHANVIEN_NAME
        {
            get { return "Staff"; }
        }
        public string GROUP_TAICHINH_NAME
        {
            get { return "Finances"; }
        }
        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion
    }
    [DataContract]
    public class Step_BalanceAndOthers_Balance_Item : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public void SendPropertyChanged_All()
        {
            SendPropertyChanged("GroupName");
            SendPropertyChanged("MucTieu");
            SendPropertyChanged("TinhHinh");
            SendPropertyChanged("NhanXet");
            SendPropertyChanged("ChiuTrachNhiem");
        }
        #endregion
        [DataMember]
        public string GroupName { get; set; }
        [DataMember]
        public string MucTieu { get; set; }

        #region TinhHinh
        [DataMember]
        public StepResult TinhHinh { get; set; }
        public string TinhHinh_TextOnReport
        {
            get
            {
                var th = TinhHinh;
                if (th == null)
                    return string.Empty;
                return th.Item.Value.ToString();
            }
            set { }
        }
        public string TinhHinh_TextOnReport_Good
        {
            get
            {
                var th = TinhHinh;
                if (th == null || th.Is_StepResult_Good == false)
                    return string.Empty;
                return "";
            }
            set { }
        }
        public string TinhHinh_TextOnReport_Normal
        {
            get
            {
                var th = TinhHinh;
                if (th == null || th.Is_StepResult_Normal == false)
                    return string.Empty;
                return "";
            }
            set { }
        }
        public string TinhHinh_TextOnReport_Bad
        {
            get
            {
                var th = TinhHinh;
                if (th == null || th.Is_StepResult_Bad == false)
                    return string.Empty;
                return "";
            }
            set { }
        }
        public byte[] TinhHinh_Image
        {
            get
            {
                var th = TinhHinh;
                if (th == null)
                    return null;
                return new byte[] { 1, 2 };
            }
            set { }
        }

        #endregion

        [DataMember]
        public string NhanXet { get; set; }
        [DataMember]
        public string ChiuTrachNhiem { get; set; }

        #region UI
        #region Title_UIText
        [DataMember]
        string _Title_UIText = string.Empty;
        public string Title_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_Title_UIText))
                    _Title_UIText = "Cockpit BSC";
                return _Title_UIText;
            }
            set
            {
                if (_Title_UIText != value)
                {
                    _Title_UIText = value;
                    SendPropertyChanged("Title_UIText");
                }
            }
        }
        #endregion

        #region MucTieu_UIText
        [DataMember]
        string _MucTieu_UIText = string.Empty;
        public string MucTieu_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_MucTieu_UIText))
                    _MucTieu_UIText = "Objectives";
                return _MucTieu_UIText;
            }
            set
            {
                if (_MucTieu_UIText != value)
                {
                    _MucTieu_UIText = value;
                    SendPropertyChanged("MucTieu_UIText");
                }
            }
        }
        #endregion

        #region TinhHinh_UIText
        [DataMember]
        string _TinhHinh_UIText = string.Empty;
        public string TinhHinh_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_TinhHinh_UIText))
                    _TinhHinh_UIText = "Status";
                return _TinhHinh_UIText;
            }
            set
            {
                if (_TinhHinh_UIText != value)
                {
                    _TinhHinh_UIText = value;
                    SendPropertyChanged("TinhHinh_UIText");
                }
            }
        }
        #endregion

        #region NhanXet_UIText
        [DataMember]
        string _NhanXet_UIText = string.Empty;
        public string NhanXet_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_NhanXet_UIText))
                    _NhanXet_UIText = "Remarks";
                return _NhanXet_UIText;
            }
            set
            {
                if (_NhanXet_UIText != value)
                {
                    _NhanXet_UIText = value;
                    SendPropertyChanged("NhanXet_UIText");
                }
            }
        }
        #endregion

        #region ChiuTrachNhiem_UIText
        [DataMember]
        string _ChiuTrachNhiem_UIText = string.Empty;
        public string ChiuTrachNhiem_UIText
        {
            get
            {
                if (string.IsNullOrEmpty(_ChiuTrachNhiem_UIText))
                    _ChiuTrachNhiem_UIText = "Responsible";
                return _ChiuTrachNhiem_UIText;
            }
            set
            {
                if (_ChiuTrachNhiem_UIText != value)
                {
                    _ChiuTrachNhiem_UIText = value;
                    SendPropertyChanged("ChiuTrachNhiem_UIText");
                }
            }
        }
        #endregion
        #endregion
    }

    public static class VMMath
    {
        public static double Round(double number)
        {
            return Math.Round(number, 2);
        }
    }

    [DataContract]
    public class Step_BalanceAndOthers_InvestmentCalculation : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        double Round(double number)
        {
            return VMMath.Round(number);
        }

        public string CompanyName { get { return ProjectData.Intance.CompanyName; } }
        #region ProjectName
        [DataMember]
        string _ProjectName = string.Empty;
        public string ProjectName
        {
            get { return _ProjectName; }
            set
            {
                if (_ProjectName != value)
                {
                    _ProjectName = value;
                    SendPropertyChanged("ProjectName");
                }
            }
        }
        #endregion

        #region UI
        #region Step_BalanceAndOthers_InvestmentCalculation_Header
        [DataMember]
        string _Step_BalanceAndOthers_InvestmentCalculation_Header = string.Empty;
        public string Step_BalanceAndOthers_InvestmentCalculation_Header
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_InvestmentCalculation_Header))
                {
                    _Step_BalanceAndOthers_InvestmentCalculation_Header = "Investment Calculation";
                }
                return _Step_BalanceAndOthers_InvestmentCalculation_Header;
            }
            set
            {
                if (_Step_BalanceAndOthers_InvestmentCalculation_Header != value)
                {
                    _Step_BalanceAndOthers_InvestmentCalculation_Header = value;
                    SendPropertyChanged("Step_BalanceAndOthers_InvestmentCalculation_Header");
                }
            }
        }
        #endregion

        #region Group_Project
        [DataMember]
        string _Group_Project = string.Empty;
        public string Group_Project
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Project))
                {
                    _Group_Project = "Project";
                }
                return _Group_Project;
            }
            set
            {
                if (_Group_Project != value)
                {
                    _Group_Project = value;
                    SendPropertyChanged("Group_Project");
                }
            }
        }
        #endregion

        #region Goals
        #region Group_Goals
        [DataMember]
        string _Group_Goals = string.Empty;
        public string Group_Goals
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Goals))
                {
                    _Group_Goals = "Goals";
                }
                return _Group_Goals;
            }
            set
            {
                if (_Group_Goals != value)
                {
                    _Group_Goals = value;
                    SendPropertyChanged("Group_Goals");
                }
            }
        }
        #endregion

        #region Group_Goals_DesiredRentability
        [DataMember]
        string _Group_Goals_DesiredRentability = string.Empty;
        public string Group_Goals_DesiredRentability
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Goals_DesiredRentability))
                {
                    _Group_Goals_DesiredRentability = "Desired Rentability";
                }
                return _Group_Goals_DesiredRentability;
            }
            set
            {
                if (_Group_Goals_DesiredRentability != value)
                {
                    _Group_Goals_DesiredRentability = value;
                    SendPropertyChanged("Group_Goals_DesiredRentability");
                }
            }
        }
        #endregion

        #region Group_Goals_PercentSign
        [DataMember]
        string _Group_Goals_PercentSign = string.Empty;
        public string Group_Goals_PercentSign
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Goals_PercentSign))
                {
                    _Group_Goals_PercentSign = "%";
                }
                return _Group_Goals_PercentSign;
            }
            set
            {
                if (_Group_Goals_PercentSign != value)
                {
                    _Group_Goals_PercentSign = value;
                    SendPropertyChanged("Group_Goals_PercentSign");
                }
            }
        }
        #endregion

        #region Group_Goals_LifeTime
        [DataMember]
        string _Group_Goals_LifeTime = string.Empty;
        public string Group_Goals_LifeTime
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Goals_LifeTime))
                {
                    _Group_Goals_LifeTime = "Life time";
                }
                return _Group_Goals_LifeTime;
            }
            set
            {
                if (_Group_Goals_LifeTime != value)
                {
                    _Group_Goals_LifeTime = value;
                    SendPropertyChanged("Group_Goals_LifeTime");
                }
            }
        }
        #endregion

        #region Group_Goals_Year
        [DataMember]
        string _Group_Goals_Year = string.Empty;
        public string Group_Goals_Year
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Goals_Year))
                {
                    _Group_Goals_Year = "years";
                }
                return _Group_Goals_Year;
            }
            set
            {
                if (_Group_Goals_Year != value)
                {
                    _Group_Goals_Year = value;
                    SendPropertyChanged("Group_Goals_Year");
                }
            }
        }
        #endregion

       
        #endregion

        #region Investment
        #region Group_Investment
        [DataMember]
        string _Group_Investment = string.Empty;
        public string Group_Investment
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Investment))
                {
                    _Group_Investment = "Investment";
                }
                return _Group_Investment;
            }
            set
            {
                if (_Group_Investment != value)
                {
                    _Group_Investment = value;
                    SendPropertyChanged("Group_Investment");
                }
            }
        }
        #endregion

        #region Group_Investment_InvestmentCosts
        [DataMember]
        string _Group_Investment_InvestmentCosts = string.Empty;
        public string Group_Investment_InvestmentCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Investment_InvestmentCosts))
                {
                    _Group_Investment_InvestmentCosts = "Investment costs";
                }
                return _Group_Investment_InvestmentCosts;
            }
            set
            {
                if (_Group_Investment_InvestmentCosts != value)
                {
                    _Group_Investment_InvestmentCosts = value;
                    SendPropertyChanged("Group_Investment_InvestmentCosts");
                }
            }
        }
        #endregion

        #region Group_Investment_AdditionalCosts
        [DataMember]
        string _Group_Investment_AdditionalCosts = string.Empty;
        public string Group_Investment_AdditionalCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Investment_AdditionalCosts))
                {
                    _Group_Investment_AdditionalCosts = "Additional costs";
                }
                return _Group_Investment_AdditionalCosts;
            }
            set
            {
                if (_Group_Investment_AdditionalCosts != value)
                {
                    _Group_Investment_AdditionalCosts = value;
                    SendPropertyChanged("Group_Investment_AdditionalCosts");
                }
            }
        }
        #endregion

        #region Group_Investment_GrossInvestment
        [DataMember]
        string _Group_Investment_GrossInvestment = string.Empty;
        public string Group_Investment_GrossInvestment
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Investment_GrossInvestment))
                {
                    _Group_Investment_GrossInvestment = "Gross Investment";
                }
                return _Group_Investment_GrossInvestment;
            }
            set
            {
                if (_Group_Investment_GrossInvestment != value)
                {
                    _Group_Investment_GrossInvestment = value;
                    SendPropertyChanged("Group_Investment_GrossInvestment");
                }
            }
        }
        #endregion

        #region Group_Investment_LiquidationValue
        [DataMember]
        string _Group_Investment_LiquidationValue = string.Empty;
        public string Group_Investment_LiquidationValue
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Investment_LiquidationValue))
                {
                    _Group_Investment_LiquidationValue = "Liquidation value";
                }
                return _Group_Investment_LiquidationValue;
            }
            set
            {
                if (_Group_Investment_LiquidationValue != value)
                {
                    _Group_Investment_LiquidationValue = value;
                    SendPropertyChanged("Group_Investment_LiquidationValue");
                }
            }
        }
        #endregion

        #region Group_Investment_NetInvestment
        [DataMember]
        string _Group_Investment_NetInvestment = string.Empty;
        public string Group_Investment_NetInvestment
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Investment_NetInvestment))
                {
                    _Group_Investment_NetInvestment = "Investment";
                }
                return _Group_Investment_NetInvestment;
            }
            set
            {
                if (_Group_Investment_NetInvestment != value)
                {
                    _Group_Investment_NetInvestment = value;
                    SendPropertyChanged("Group_Investment_NetInvestment");
                }
            }
        }
        #endregion
        #endregion

        #region Group_Investment_MoneySign
        [DataMember]
        string _Group_Investment_MoneySign = string.Empty;
        public string Group_Investment_MoneySign
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Investment_MoneySign))
                {
                    _Group_Investment_MoneySign = "$";
                }
                return _Group_Investment_MoneySign;
            }
            set
            {
                if (_Group_Investment_MoneySign != value)
                {
                    _Group_Investment_MoneySign = value;
                    SendPropertyChanged("Group_Investment_MoneySign");
                }
            }
        }
        #endregion

        #region Group_Earning
        #region Group_Earning
        [DataMember]
        string _Group_Earning = string.Empty;
        public string Group_Earning
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Earning))
                {
                    _Group_Earning = "Earning";
                }
                return _Group_Earning;
            }
            set
            {
                if (_Group_Earning != value)
                {
                    _Group_Earning = value;
                    SendPropertyChanged("Group_Earning");
                }
            }
        }
        #endregion

        #region Group_Earning_EarningsPerYear
        [DataMember]
        string _Group_Earning_EarningsPerYear = string.Empty;
        public string Group_Earning_EarningsPerYear
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Earning_EarningsPerYear))
                {
                    _Group_Earning_EarningsPerYear = "Earnings per year";
                }
                return _Group_Earning_EarningsPerYear;
            }
            set
            {
                if (_Group_Earning_EarningsPerYear != value)
                {
                    _Group_Earning_EarningsPerYear = value;
                    SendPropertyChanged("Group_Earning_EarningsPerYear");
                }
            }
        }
        #endregion

        #region Group_Earning_TotalEarnings
        [DataMember]
        string _Group_Earning_TotalEarnings = string.Empty;
        public string Group_Earning_TotalEarnings
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Earning_TotalEarnings))
                {
                    _Group_Earning_TotalEarnings = "Total earnings";
                }
                return _Group_Earning_TotalEarnings;
            }
            set
            {
                if (_Group_Earning_TotalEarnings != value)
                {
                    _Group_Earning_TotalEarnings = value;
                    SendPropertyChanged("Group_Earning_TotalEarnings");
                }
            }
        }
        #endregion
        #endregion

        #region Group_FixedCostsPerYear
        #region Group_FixedCostsPerYear
        [DataMember]
        string _Group_FixedCostsCerYear = string.Empty;
        public string Group_FixedCostsPerYear
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_FixedCostsCerYear))
                {
                    _Group_FixedCostsCerYear = "Fixed costs per year";
                }
                return _Group_FixedCostsCerYear;
            }
            set
            {
                if (_Group_FixedCostsCerYear != value)
                {
                    _Group_FixedCostsCerYear = value;
                    SendPropertyChanged("Group_Fixed costs per year");
                }
            }
        }
        #endregion

        #region Group_FixedCostsPerYear_PercentInterest
        [DataMember]
        string _Group_FixedCostsPerYear_PercentInterest = string.Empty;
        public string Group_FixedCostsPerYear_PercentInterest
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_FixedCostsPerYear_PercentInterest))
                {
                    _Group_FixedCostsPerYear_PercentInterest = "% Interest";
                }
                return _Group_FixedCostsPerYear_PercentInterest;
            }
            set
            {
                if (_Group_FixedCostsPerYear_PercentInterest != value)
                {
                    _Group_FixedCostsPerYear_PercentInterest = value;
                    SendPropertyChanged("Group_FixedCostsPerYear_PercentInterest");
                }
            }
        }
        #endregion

        #region Group_FixedCostsPerYear_Depreciation
        [DataMember]
        string _Group_FixedCostsPerYear_Depreciation = string.Empty;
        public string Group_FixedCostsPerYear_Depreciation
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_FixedCostsPerYear_Depreciation))
                {
                    _Group_FixedCostsPerYear_Depreciation = "Depreciation";
                }
                return _Group_FixedCostsPerYear_Depreciation;
            }
            set
            {
                if (_Group_FixedCostsPerYear_Depreciation != value)
                {
                    _Group_FixedCostsPerYear_Depreciation = value;
                    SendPropertyChanged("Group_FixedCostsPerYear_Depreciation");
                }
            }
        }
        #endregion

        #region Group_FixedCostsPerYear_IndirectLaborCosts
        [DataMember]
        string _Group_FixedCostsPerYear_IndirectLaborCosts = string.Empty;
        public string Group_FixedCostsPerYear_IndirectLaborCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_FixedCostsPerYear_IndirectLaborCosts))
                {
                    _Group_FixedCostsPerYear_IndirectLaborCosts = "Indirect labor costs";
                }
                return _Group_FixedCostsPerYear_IndirectLaborCosts;
            }
            set
            {
                if (_Group_FixedCostsPerYear_IndirectLaborCosts != value)
                {
                    _Group_FixedCostsPerYear_IndirectLaborCosts = value;
                    SendPropertyChanged("Group_FixedCostsPerYear_IndirectLaborCosts");
                }
            }
        }
        #endregion

        #region Group_FixedCostsPerYear_OtherFixedCosts
        [DataMember]
        string _Group_FixedCostsPerYear_OtherFixedCosts = string.Empty;
        public string Group_FixedCostsPerYear_OtherFixedCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_FixedCostsPerYear_OtherFixedCosts))
                {
                    _Group_FixedCostsPerYear_OtherFixedCosts = "Other fixed costs";
                }
                return _Group_FixedCostsPerYear_OtherFixedCosts;
            }
            set
            {
                if (_Group_FixedCostsPerYear_OtherFixedCosts != value)
                {
                    _Group_FixedCostsPerYear_OtherFixedCosts = value;
                    SendPropertyChanged("Group_FixedCostsPerYear_OtherFixedCosts");
                }
            }
        }
        #endregion

        #region Group_FixedCostsPerYear_Sum
        [DataMember]
        string _Group_FixedCostsPerYear_Sum = string.Empty;
        public string Group_FixedCostsPerYear_Sum
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_FixedCostsPerYear_Sum))
                {
                    _Group_FixedCostsPerYear_Sum = "Sum";
                }
                return _Group_FixedCostsPerYear_Sum;
            }
            set
            {
                if (_Group_FixedCostsPerYear_Sum != value)
                {
                    _Group_FixedCostsPerYear_Sum = value;
                    SendPropertyChanged("Group_FixedCostsPerYear_Sum");
                }
            }
        }
        #endregion

        #endregion

        #region Group_VariableCostsPerYear
        #region Group_VariableCostsPerYear
        [DataMember]
        string _Group_VariableCostsPerYear = string.Empty;
        public string Group_VariableCostsPerYear
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_VariableCostsPerYear))
                {
                    _Group_VariableCostsPerYear = "Variable costs per year";
                }
                return _Group_VariableCostsPerYear;
            }
            set
            {
                if (_Group_VariableCostsPerYear != value)
                {
                    _Group_VariableCostsPerYear = value;
                    SendPropertyChanged("Group_VariableCostsPerYear");
                }
            }
        }
        #endregion

        #region Group_VariableCostsPerYear_VariableWages
        [DataMember]
        string _Group_VariableCostsPerYear_VariableWages = string.Empty;
        public string Group_VariableCostsPerYear_VariableWages
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_VariableCostsPerYear_VariableWages))
                {
                    _Group_VariableCostsPerYear_VariableWages = "Variable wages";
                }
                return _Group_VariableCostsPerYear_VariableWages;
            }
            set
            {
                if (_Group_VariableCostsPerYear_VariableWages != value)
                {
                    _Group_VariableCostsPerYear_VariableWages = value;
                    SendPropertyChanged("Group_VariableCostsPerYear_VariableWages");
                }
            }
        }
        #endregion

        #region Group_VariableCostsPerYear_VariableMaterialCosts
        [DataMember]
        string _Group_VariableCostsPerYear_VariableMaterialCosts = string.Empty;
        public string Group_VariableCostsPerYear_VariableMaterialCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_VariableCostsPerYear_VariableMaterialCosts))
                {
                    _Group_VariableCostsPerYear_VariableMaterialCosts = "Variable material costs";
                }
                return _Group_VariableCostsPerYear_VariableMaterialCosts;
            }
            set
            {
                if (_Group_VariableCostsPerYear_VariableMaterialCosts != value)
                {
                    _Group_VariableCostsPerYear_VariableMaterialCosts = value;
                    SendPropertyChanged("Group_VariableCostsPerYear_VariableMaterialCosts");
                }
            }
        }
        #endregion

        #region Group_VariableCostsPerYear_OtherVariableCosts
        [DataMember]
        string _Group_VariableCostsPerYear_OtherVariableCosts = string.Empty;
        public string Group_VariableCostsPerYear_OtherVariableCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_VariableCostsPerYear_OtherVariableCosts))
                {
                    _Group_VariableCostsPerYear_OtherVariableCosts = "Other variable costs";
                }
                return _Group_VariableCostsPerYear_OtherVariableCosts;
            }
            set
            {
                if (_Group_VariableCostsPerYear_OtherVariableCosts != value)
                {
                    _Group_VariableCostsPerYear_OtherVariableCosts = value;
                    SendPropertyChanged("Group_VariableCostsPerYear_OtherVariableCosts");
                }
            }
        }
        #endregion

        #region Group_VariableCostsPerYear_Sum
        [DataMember]
        string _Group_VariableCostsPerYear_Sum = string.Empty;
        public string Group_VariableCostsPerYear_Sum
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_VariableCostsPerYear_Sum))
                {
                    _Group_VariableCostsPerYear_Sum = "Sum";
                }
                return _Group_VariableCostsPerYear_Sum;
            }
            set
            {
                if (_Group_VariableCostsPerYear_Sum != value)
                {
                    _Group_VariableCostsPerYear_Sum = value;
                    SendPropertyChanged("Group_VariableCostsPerYear_Sum");
                }
            }
        }
        #endregion
        #endregion

        #region Group_TotalCosts
        #region Group_TotalCosts
        [DataMember]
        string _Group_TotalCosts = string.Empty;
        public string Group_TotalCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_TotalCosts))
                {
                    _Group_TotalCosts = "Total costs";
                }
                return _Group_TotalCosts;
            }
            set
            {
                if (_Group_TotalCosts != value)
                {
                    _Group_TotalCosts = value;
                    SendPropertyChanged("Group_TotalCosts");
                }
            }
        }
        #endregion

        #region Group_TotalCosts_PerYear_Sum
        [DataMember]
        string _Group_TotalCosts_PerYear_Sum = string.Empty;
        public string Group_TotalCosts_PerYear_Sum
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_TotalCosts_PerYear_Sum))
                {
                    _Group_TotalCosts_PerYear_Sum = "per year | over all";
                }
                return _Group_TotalCosts_PerYear_Sum;
            }
            set
            {
                if (_Group_TotalCosts_PerYear_Sum != value)
                {
                    _Group_TotalCosts_PerYear_Sum = value;
                    SendPropertyChanged("Group_TotalCosts_PerYear_Sum");
                }
            }
        }
        #endregion
        #endregion

        #region Group_Result
        #region Group_Result
        [DataMember]
        string _Group_Result = string.Empty;
        public string Group_Result
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Result))
                {
                    _Group_Result = "Result";
                }
                return _Group_Result;
            }
            set
            {
                if (_Group_Result != value)
                {
                    _Group_Result = value;
                    SendPropertyChanged("Group_Result");
                }
            }
        }
        #endregion

        #region Group_Result_ResultPerYear
        [DataMember]
        string _Group_Result_ResultPerYear = string.Empty;
        public string Group_Result_ResultPerYear
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Result_ResultPerYear))
                {
                    _Group_Result_ResultPerYear = "Result per year";
                }
                return _Group_Result_ResultPerYear;
            }
            set
            {
                if (_Group_Result_ResultPerYear != value)
                {
                    _Group_Result_ResultPerYear = value;
                    SendPropertyChanged("Group_Result_ResultPerYear");
                }
            }
        }
        #endregion

        #region Group_Result_Rentability
        [DataMember]
        string _Group_Result_Rentability = string.Empty;
        public string Group_Result_Rentability
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Result_Rentability))
                {
                    _Group_Result_Rentability = "Rentability";
                }
                return _Group_Result_Rentability;
            }
            set
            {
                if (_Group_Result_Rentability != value)
                {
                    _Group_Result_Rentability = value;
                    SendPropertyChanged("Group_Result_Rentability");
                }
            }
        }
        #endregion

        #region Group_Result_ResultTotal
        [DataMember]
        string _Group_Result_ResultTotal = string.Empty;
        public string Group_Result_ResultTotal
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Result_ResultTotal))
                {
                    _Group_Result_ResultTotal = "Result total";
                }
                return _Group_Result_ResultTotal;
            }
            set
            {
                if (_Group_Result_ResultTotal != value)
                {
                    _Group_Result_ResultTotal = value;
                    SendPropertyChanged("Group_Result_ResultTotal");
                }
            }
        }
        #endregion

        #region Group_Result_ResultTotal_LiquidationValueConsidered
        [DataMember]
        string _Group_Result_ResultTotal_LiquidationValueConsidered = string.Empty;
        public string Group_Result_ResultTotal_LiquidationValueConsidered
        {
            get
            {
                if (string.IsNullOrEmpty(_Group_Result_ResultTotal_LiquidationValueConsidered))
                {
                    _Group_Result_ResultTotal_LiquidationValueConsidered = "liquidation value considered";
                }
                return _Group_Result_ResultTotal_LiquidationValueConsidered;
            }
            set
            {
                if (_Group_Result_ResultTotal_LiquidationValueConsidered != value)
                {
                    _Group_Result_ResultTotal_LiquidationValueConsidered = value;
                    SendPropertyChanged("Group_Result_ResultTotal_LiquidationValueConsidered");
                }
            }
        }
        #endregion
        #endregion
        #endregion



        #region Goals
        #region DesiredRentability
        [DataMember]
        double _DesiredRentability = 0;
        public double DesiredRentability
        {
            get { return _DesiredRentability; }
            set
            {
                if (_DesiredRentability != value)
                {
                    _DesiredRentability = value;
                    SendPropertyChanged("DesiredRentability");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion
        #region LifeTime
        [DataMember]
        int _LifeTime = 0;
        public int LifeTime
        {
            get { return _LifeTime; }
            set
            {
                if (_LifeTime != value)
                {
                    _LifeTime = value;
                    SendPropertyChanged("LifeTime");
                    SendPropertyChanged("TotalEarnings");
                    SendPropertyChanged("FixedCostsSum");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion
        #endregion

        #region Investment
        #region InvestmentCosts
        [DataMember]
        double _InvestmentCosts = 0;
        public double InvestmentCosts
        {
            get { return _InvestmentCosts; }
            set
            {
                if (_InvestmentCosts != value)
                {
                    _InvestmentCosts = value;
                    SendPropertyChanged("InvestmentCosts");
                    SendPropertyChanged("GrossInvestment");
                    SendPropertyChanged("Depreciation");
                    SendPropertyChanged("FixedCostsSum");
                    SendPropertyChanged("InterestMoney");
                    SendPropertyChanged("NetInvestment");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                }
            }
        }
        #endregion

        #region AdditionalCosts
        [DataMember]
        double _AdditionalCosts = 0;
        public double AdditionalCosts
        {
            get { return _AdditionalCosts; }
            set
            {
                if (_AdditionalCosts != value)
                {
                    _AdditionalCosts = value;
                    SendPropertyChanged("AdditionalCosts");
                    SendPropertyChanged("GrossInvestment");
                    SendPropertyChanged("Depreciation");
                    SendPropertyChanged("FixedCostsSum");
                    SendPropertyChanged("InterestMoney");
                    SendPropertyChanged("NetInvestment");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region GrossInvestment
        public double GrossInvestment
        {
            get { return Round(InvestmentCosts + AdditionalCosts); }
        }
        #endregion

        #region LiquidationValue
        [DataMember]
        double _LiquidationValue = 0;
        public double LiquidationValue
        {
            get { return _LiquidationValue; }
            set
            {
                if (_LiquidationValue != value)
                {
                    _LiquidationValue = value;
                    SendPropertyChanged("LiquidationValue");
                    SendPropertyChanged("NetInvestment");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region NetInvestment
        public double NetInvestment
        {
            get { return Round(GrossInvestment - LiquidationValue); }
        }
        #endregion
        #endregion

        #region Earning
        #region EarningsPerYear
        [DataMember]
        double _EarningsPerYear = 0;
        public double EarningsPerYear
        {
            get { return _EarningsPerYear; }
            set
            {
                if (_EarningsPerYear != value)
                {
                    _EarningsPerYear = value;
                    SendPropertyChanged("EarningsPerYear");
                    SendPropertyChanged("TotalEarnings");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region TotalEarnings
        public double TotalEarnings
        {
            get { return Round(EarningsPerYear * LifeTime); }
        }
        #endregion
        #endregion

        #region Fixed costs per year
        #region InterestPercent
        [DataMember]
        double _InterestPercent = 0;
        public double InterestPercent
        {
            get { return _InterestPercent; }
            set
            {
                if (_InterestPercent != value)
                {
                    _InterestPercent = value;
                    SendPropertyChanged("InterestPercent");
                    SendPropertyChanged("InterestMoney");
                    SendPropertyChanged("FixedCostsSum");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region InterestMoney
        public double InterestMoney
        {
            get { return Round((InterestPercent * GrossInvestment) / 100); }
        }
        #endregion

        #region Depreciation
        public double Depreciation
        {
            get { return Round((GrossInvestment) / LifeTime); }
        }
        #endregion

        #region IndirectLaborCosts
        [DataMember]
        double _IndirectLaborCosts = 0;
        public double IndirectLaborCosts
        {
            get { return _IndirectLaborCosts; }
            set
            {
                if (_IndirectLaborCosts != value)
                {
                    _IndirectLaborCosts = value;
                    SendPropertyChanged("IndirectLaborCosts");
                    SendPropertyChanged("FixedCostsSum");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region OtherFixedCosts
        [DataMember]
        double _OtherFixedCosts = 0;
        public double OtherFixedCosts
        {
            get { return _OtherFixedCosts; }
            set
            {
                if (_OtherFixedCosts != value)
                {
                    _OtherFixedCosts = value;
                    SendPropertyChanged("OtherFixedCosts");
                    SendPropertyChanged("FixedCostsSum");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region FixedCostsSum
        public double FixedCostsSum
        {
            get { return Round(InterestMoney + Depreciation + IndirectLaborCosts + OtherFixedCosts); }
        }
        #endregion
        #endregion

        #region Variable costs per year
        #region VariableWages
        [DataMember]
        double _VariableWages = 0;
        public double VariableWages
        {
            get { return _VariableWages; }
            set
            {
                if (_VariableWages != value)
                {
                    _VariableWages = value;
                    SendPropertyChanged("VariableWages");
                    SendPropertyChanged("VariableCostsSum");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region VariableaterialCosts
        [DataMember]
        double _VariableaterialCosts = 0;
        public double VariableaterialCosts
        {
            get { return _VariableaterialCosts; }
            set
            {
                if (_VariableaterialCosts != value)
                {
                    _VariableaterialCosts = value;
                    SendPropertyChanged("VariableaterialCosts");
                    SendPropertyChanged("VariableCostsSum");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region OtherVariableCosts
        [DataMember]
        double _OtherVariableCosts = 0;
        public double OtherVariableCosts
        {
            get { return _OtherVariableCosts; }
            set
            {
                if (_OtherVariableCosts != value)
                {
                    _OtherVariableCosts = value;
                    SendPropertyChanged("OtherVariableCosts");
                    SendPropertyChanged("VariableCostsSum");
                    SendPropertyChanged("TotalCostSum1");
                    SendPropertyChanged("TotalCostSum2");
                    SendPropertyChanged("ResultPerYear");
                    SendPropertyChanged("ResultTotal");
                    SendPropertyChanged("Rentability");
                }
            }
        }
        #endregion

        #region VariableCostsSum
        public double VariableCostsSum
        {
            get { return Round(VariableWages + VariableaterialCosts + OtherVariableCosts); }
        }
        #endregion
        #endregion

        #region TotalCostSum
        public double TotalCostSum1
        {
            get { return Round(FixedCostsSum + VariableCostsSum); }
        }
        public double TotalCostSum2
        {
            get { return Round(TotalCostSum1 * LifeTime); }
        }
        #endregion

        #region Result
        public double ResultPerYear
        {
            get { return Round(EarningsPerYear - TotalCostSum1); }
        }
        public double ResultTotal
        {
            get { return Round(TotalEarnings - TotalCostSum2 + LiquidationValue); }
        }
        public double Rentability
        {
            get { return Round((ResultPerYear * 100) / GrossInvestment); }
        }
        #endregion

        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion

    }

    [DataContract]
    public class Step_BalanceAndOthers_Trade : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region UI
        #region Step_BalanceAndOthers_Trade_Header
        [DataMember]
        string _Step_BalanceAndOthers_Trade_Header = string.Empty;
        public string Step_BalanceAndOthers_Trade_Header
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_Trade_Header))
                {
                    _Step_BalanceAndOthers_Trade_Header = "Trade Calculation";
                }
                return _Step_BalanceAndOthers_Trade_Header;
            }
            set
            {
                if (_Step_BalanceAndOthers_Trade_Header != value)
                {
                    _Step_BalanceAndOthers_Trade_Header = value;
                    SendPropertyChanged("Step_BalanceAndOthers_Trade_Header");
                }
            }
        }
        #endregion

        #region UI_Text_Currency
        [DataMember]
        string _UI_Text_Currency = string.Empty;
        public string UI_Text_Currency
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_Currency))
                {
                    _UI_Text_Currency = "Currency";
                }
                return _UI_Text_Currency;
            }
            set
            {
                if (_UI_Text_Currency != value)
                {
                    _UI_Text_Currency = value;
                    SendPropertyChanged("UI_Text_Currency");
                }
            }
        }
        #endregion

        #region UI_Text_ListPriceList
        [DataMember]
        string _UI_Text_ListPriceList = string.Empty;
        public string UI_Text_ListPriceList
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_ListPriceList))
                {
                    _UI_Text_ListPriceList = "List price list";
                }
                return _UI_Text_ListPriceList;
            }
            set
            {
                if (_UI_Text_ListPriceList != value)
                {
                    _UI_Text_ListPriceList = value;
                    SendPropertyChanged("UI_Text_ListPriceList");
                }
            }
        }
        #endregion

        #region UI_Text_TradeDiscount
        [DataMember]
        string _UI_Text_TradeDiscount = string.Empty;
        public string UI_Text_TradeDiscount
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_TradeDiscount))
                {
                    _UI_Text_TradeDiscount = "Trade discount";
                }
                return _UI_Text_TradeDiscount;
            }
            set
            {
                if (_UI_Text_TradeDiscount != value)
                {
                    _UI_Text_TradeDiscount = value;
                    SendPropertyChanged("UI_Text_TradeDiscount");
                }
            }
        }
        #endregion

        #region UI_Text_InvoicePriceSupplier
        [DataMember]
        string _UI_Text_InvoicePriceSupplier = string.Empty;
        public string UI_Text_InvoicePriceSupplier
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_InvoicePriceSupplier))
                {
                    _UI_Text_InvoicePriceSupplier = "Invoice price supplier";
                }
                return _UI_Text_InvoicePriceSupplier;
            }
            set
            {
                if (_UI_Text_InvoicePriceSupplier != value)
                {
                    _UI_Text_InvoicePriceSupplier = value;
                    SendPropertyChanged("UI_Text_InvoicePriceSupplier");
                }
            }
        }
        #endregion

        #region UI_Text_OtherSupplierDiscounts
        [DataMember]
        string _UI_Text_OtherSupplierDiscounts = string.Empty;
        public string UI_Text_OtherSupplierDiscounts
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_OtherSupplierDiscounts))
                {
                    _UI_Text_OtherSupplierDiscounts = "Other supplier discounts";
                }
                return _UI_Text_OtherSupplierDiscounts;
            }
            set
            {
                if (_UI_Text_OtherSupplierDiscounts != value)
                {
                    _UI_Text_OtherSupplierDiscounts = value;
                    SendPropertyChanged("UI_Text_OtherSupplierDiscounts");
                }
            }
        }
        #endregion

        #region UI_Text_InvoicePriceSupplier2
        [DataMember]
        string _UI_Text_InvoicePriceSupplier2 = string.Empty;
        public string UI_Text_InvoicePriceSupplier2
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_InvoicePriceSupplier2))
                {
                    _UI_Text_InvoicePriceSupplier2 = "Invoice price supplier";
                }
                return _UI_Text_InvoicePriceSupplier2;
            }
            set
            {
                if (_UI_Text_InvoicePriceSupplier2 != value)
                {
                    _UI_Text_InvoicePriceSupplier2 = value;
                    SendPropertyChanged("UI_Text_InvoicePriceSupplier2");
                }
            }
        }
        #endregion

        #region UI_Text_OtherCashDiscounts
        [DataMember]
        string _UI_Text_OtherCashDiscounts = string.Empty;
        public string UI_Text_OtherCashDiscounts
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_OtherCashDiscounts))
                {
                    _UI_Text_OtherCashDiscounts = "Supplier cash discounts";
                }
                return _UI_Text_OtherCashDiscounts;
            }
            set
            {
                if (_UI_Text_OtherCashDiscounts != value)
                {
                    _UI_Text_OtherCashDiscounts = value;
                    SendPropertyChanged("UI_Text_OtherCashDiscounts");
                }
            }
        }
        #endregion

        #region UI_Text_PurchasePrice
        [DataMember]
        string _UI_Text_PurchasePrice = string.Empty;
        public string UI_Text_PurchasePrice
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_PurchasePrice))
                {
                    _UI_Text_PurchasePrice = "Purchase Price";
                }
                return _UI_Text_PurchasePrice;
            }
            set
            {
                if (_UI_Text_PurchasePrice != value)
                {
                    _UI_Text_PurchasePrice = value;
                    SendPropertyChanged("UI_Text_PurchasePrice");
                }
            }
        }
        #endregion

        #region UI_Text_PurchasingCosts
        [DataMember]
        string _UI_Text_PurchasingCosts = string.Empty;
        public string UI_Text_PurchasingCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_PurchasingCosts))
                {
                    _UI_Text_PurchasingCosts = "Purchasing costs (eg: packing, transportation, duty)";
                }
                return _UI_Text_PurchasingCosts;
            }
            set
            {
                if (_UI_Text_PurchasingCosts != value)
                {
                    _UI_Text_PurchasingCosts = value;
                    SendPropertyChanged("UI_Text_PurchasingCosts");
                }
            }
        }
        #endregion

        #region UI_Text_AcquistitionPrice
        [DataMember]
        string _UI_Text_AcquistitionPrice = string.Empty;
        public string UI_Text_AcquistitionPrice
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_AcquistitionPrice))
                {
                    _UI_Text_AcquistitionPrice = "Acquistition price";
                }
                return _UI_Text_AcquistitionPrice;
            }
            set
            {
                if (_UI_Text_AcquistitionPrice != value)
                {
                    _UI_Text_AcquistitionPrice = value;
                    SendPropertyChanged("UI_Text_AcquistitionPrice");
                }
            }
        }
        #endregion

        #region UI_Text_IndirectCosts
        [DataMember]
        string _UI_Text_IndirectCosts = string.Empty;
        public string UI_Text_IndirectCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_IndirectCosts))
                {
                    _UI_Text_IndirectCosts = "Indirect costs (eg: wages, rental)";
                }
                return _UI_Text_IndirectCosts;
            }
            set
            {
                if (_UI_Text_IndirectCosts != value)
                {
                    _UI_Text_IndirectCosts = value;
                    SendPropertyChanged("UI_Text_IndirectCosts");
                }
            }
        }
        #endregion

        #region UI_Text_CostPrice
        [DataMember]
        string _UI_Text_CostPrice = string.Empty;
        public string UI_Text_CostPrice
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_CostPrice))
                {
                    _UI_Text_CostPrice = "Cost price";
                }
                return _UI_Text_CostPrice;
            }
            set
            {
                if (_UI_Text_CostPrice != value)
                {
                    _UI_Text_CostPrice = value;
                    SendPropertyChanged("UI_Text_CostPrice");
                }
            }
        }
        #endregion

        #region UI_Text_Profit
        [DataMember]
        string _UI_Text_Profit = string.Empty;
        public string UI_Text_Profit
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_Profit))
                {
                    _UI_Text_Profit = "Profit";
                }
                return _UI_Text_Profit;
            }
            set
            {
                if (_UI_Text_Profit != value)
                {
                    _UI_Text_Profit = value;
                    SendPropertyChanged("UI_Text_Profit");
                }
            }
        }
        #endregion

        #region UI_Text_GrossSalesPrice
        [DataMember]
        string _UI_Text_GrossSalesPrice = string.Empty;
        public string UI_Text_GrossSalesPrice
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_GrossSalesPrice))
                {
                    _UI_Text_GrossSalesPrice = "Gross sales price";
                }
                return _UI_Text_GrossSalesPrice;
            }
            set
            {
                if (_UI_Text_GrossSalesPrice != value)
                {
                    _UI_Text_GrossSalesPrice = value;
                    SendPropertyChanged("UI_Text_GrossSalesPrice");
                }
            }
        }
        #endregion

        #region UI_Text_SalesCost
        [DataMember]
        string _UI_Text_SalesCost = string.Empty;
        public string UI_Text_SalesCost
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_SalesCost))
                {
                    _UI_Text_SalesCost = "Sales cost (eg:  packing, transportation, sale commission)";
                }
                return _UI_Text_SalesCost;
            }
            set
            {
                if (_UI_Text_SalesCost != value)
                {
                    _UI_Text_SalesCost = value;
                    SendPropertyChanged("UI_Text_SalesCost");
                }
            }
        }
        #endregion

        #region UI_Text_NetSalesPrice
        [DataMember]
        string _UI_Text_NetSalesPrice = string.Empty;
        public string UI_Text_NetSalesPrice
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_NetSalesPrice))
                {
                    _UI_Text_NetSalesPrice = "Net sales price";
                }
                return _UI_Text_NetSalesPrice;
            }
            set
            {
                if (_UI_Text_NetSalesPrice != value)
                {
                    _UI_Text_NetSalesPrice = value;
                    SendPropertyChanged("UI_Text_NetSalesPrice");
                }
            }
        }
        #endregion

        #region UI_Text_CustomerCashDiscount
        [DataMember]
        string _UI_Text_CustomerCashDiscount = string.Empty;
        public string UI_Text_CustomerCashDiscount
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_CustomerCashDiscount))
                {
                    _UI_Text_CustomerCashDiscount = "Customer cash discount";
                }
                return _UI_Text_CustomerCashDiscount;
            }
            set
            {
                if (_UI_Text_CustomerCashDiscount != value)
                {
                    _UI_Text_CustomerCashDiscount = value;
                    SendPropertyChanged("UI_Text_CustomerCashDiscount");
                }
            }
        }
        #endregion

        #region UI_Text_InvoicePrice
        [DataMember]
        string _UI_Text_InvoicePrice = string.Empty;
        public string UI_Text_InvoicePrice
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_InvoicePrice))
                {
                    _UI_Text_InvoicePrice = "Invoice price";
                }
                return _UI_Text_InvoicePrice;
            }
            set
            {
                if (_UI_Text_InvoicePrice != value)
                {
                    _UI_Text_InvoicePrice = value;
                    SendPropertyChanged("UI_Text_InvoicePrice");
                }
            }
        }
        #endregion

        #region UI_Text_CustomerDiscount
        [DataMember]
        string _UI_Text_CustomerDiscount = string.Empty;
        public string UI_Text_CustomerDiscount
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_CustomerDiscount))
                {
                    _UI_Text_CustomerDiscount = "Customer discount";
                }
                return _UI_Text_CustomerDiscount;
            }
            set
            {
                if (_UI_Text_CustomerDiscount != value)
                {
                    _UI_Text_CustomerDiscount = value;
                    SendPropertyChanged("UI_Text_CustomerDiscount");
                }
            }
        }
        #endregion

        #region UI_Text_ListPriceSales
        [DataMember]
        string _UI_Text_ListPriceSales = string.Empty;
        public string UI_Text_ListPriceSales
        {
            get
            {
                if (string.IsNullOrEmpty(_UI_Text_ListPriceSales))
                {
                    _UI_Text_ListPriceSales = "List price (sales)";
                }
                return _UI_Text_ListPriceSales;
            }
            set
            {
                if (_UI_Text_ListPriceSales != value)
                {
                    _UI_Text_ListPriceSales = value;
                    SendPropertyChanged("UI_Text_ListPriceSales");
                }
            }
        }
        #endregion

        #endregion


        public string CompanyName { get { return ProjectData.Intance.CompanyName; } }
        #region ProductName
        [DataMember]
        string _ProductName = string.Empty;
        public string ProductName
        {
            get { return _ProductName; }
            set
            {
                if (_ProductName != value)
                {
                    _ProductName = value;
                    SendPropertyChanged("ProductName");
                }
            }
        }
        #endregion

        #region CurrencyChar
        [DataMember]
        string _CurrencyChar = string.Empty;
        public string CurrencyChar
        {
            get { return _CurrencyChar; }
            set
            {
                if (_CurrencyChar != value)
                {
                    _CurrencyChar = value;
                    SendPropertyChanged("CurrencyChar");
                }
            }
        }
        #endregion

        #region ListPriceSupplier
        [DataMember]
        double _ListPriceSupplier = 0;
        public double ListPriceSupplier
        {
            get { return _ListPriceSupplier; }
            set
            {
                if (_ListPriceSupplier != value)
                {
                    _ListPriceSupplier = value;
                    SendPropertyChanged("ListPriceSupplier");
                    SendPropertyChanged("TradeDiscountMoney");
                    SendPropertyChanged("InvoicePriceSupplier");
                    SendPropertyChanged("OtherSupplierDiscountsMoney");
                    SendPropertyChanged("InvoicePriceSupplier2");
                    SendPropertyChanged("OtherCashDiscountsMoney");
                    SendPropertyChanged("PurchasePrice");
                    SendPropertyChanged("PurchasingCostsMoney");
                    SendPropertyChanged("AcquistitionPrice");
                    SendPropertyChanged("IndirectCostsMoney");
                    SendPropertyChanged("CostPrice");
                    SendPropertyChanged("ProfitMoney");
                    SendPropertyChanged("GrossSalesPrice");
                    SendPropertyChanged("SalesCostMoney");
                    SendPropertyChanged("NetSalesPrice");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");
                }
            }
        }
        #endregion

        #region TradeDiscountPercent
        [DataMember]
        double _TradeDiscountPercent = 0;
        public double TradeDiscountPercent
        {
            get { return _TradeDiscountPercent; }
            set
            {
                if (_TradeDiscountPercent != value)
                {
                    _TradeDiscountPercent = value;
                    SendPropertyChanged("TradeDiscountPercent");
                    SendPropertyChanged("TradeDiscountMoney");
                    SendPropertyChanged("InvoicePriceSupplier");
                    SendPropertyChanged("OtherSupplierDiscountsMoney");
                    SendPropertyChanged("InvoicePriceSupplier2");
                    SendPropertyChanged("OtherCashDiscountsMoney");
                    SendPropertyChanged("PurchasePrice");
                    SendPropertyChanged("PurchasingCostsMoney");
                    SendPropertyChanged("AcquistitionPrice");
                    SendPropertyChanged("IndirectCostsMoney");
                    SendPropertyChanged("CostPrice");
                    SendPropertyChanged("ProfitMoney");
                    SendPropertyChanged("GrossSalesPrice");
                    SendPropertyChanged("SalesCostMoney");
                    SendPropertyChanged("NetSalesPrice");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");
                }
            }
        }
        #endregion

        #region TradeDiscountMoney
        public double TradeDiscountMoney
        {
            get { return VMMath.Round(ListPriceSupplier * ((TradeDiscountPercent) / 100)); }
        }
        #endregion


        #region InvoicePriceSupplier
        public double InvoicePriceSupplier
        {
            get { return VMMath.Round(ListPriceSupplier - TradeDiscountMoney); }
        }
        #endregion

        #region OtherSupplierDiscountsPercent
        [DataMember]
        double _OtherSupplierDiscountsPercent = 0;
        public double OtherSupplierDiscountsPercent
        {
            get { return _OtherSupplierDiscountsPercent; }
            set
            {
                if (_OtherSupplierDiscountsPercent != value)
                {
                    _OtherSupplierDiscountsPercent = value;
                    SendPropertyChanged("OtherSupplierDiscountsPercent");
                    SendPropertyChanged("OtherSupplierDiscountsMoney");
                    SendPropertyChanged("InvoicePriceSupplier2");
                    SendPropertyChanged("OtherCashDiscountsMoney");
                    SendPropertyChanged("PurchasePrice");
                    SendPropertyChanged("PurchasingCostsMoney");
                    SendPropertyChanged("AcquistitionPrice");
                    SendPropertyChanged("IndirectCostsMoney");
                    SendPropertyChanged("CostPrice");
                    SendPropertyChanged("ProfitMoney");
                    SendPropertyChanged("GrossSalesPrice");
                    SendPropertyChanged("SalesCostMoney");
                    SendPropertyChanged("NetSalesPrice");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");

                }
            }
        }
        #endregion

        #region OtherSupplierDiscountsMoney
        public double OtherSupplierDiscountsMoney
        {
            get { return VMMath.Round(InvoicePriceSupplier * (OtherSupplierDiscountsPercent / 100d)); }
        }
        #endregion


        #region InvoicePriceSupplier2
        public double InvoicePriceSupplier2
        {
            get { return VMMath.Round(InvoicePriceSupplier - OtherSupplierDiscountsMoney); }
        }
        #endregion

        #region OtherCashDiscountsPercent
        [DataMember]
        double _OtherCashDiscountsPercent = 0;
        public double OtherCashDiscountsPercent
        {
            get { return _OtherCashDiscountsPercent; }
            set
            {
                if (_OtherCashDiscountsPercent != value)
                {
                    _OtherCashDiscountsPercent = value;
                    SendPropertyChanged("OtherCashDiscountsPercent");
                    SendPropertyChanged("OtherCashDiscountsMoney");
                    SendPropertyChanged("PurchasePrice");
                    SendPropertyChanged("PurchasingCostsMoney");
                    SendPropertyChanged("AcquistitionPrice");
                    SendPropertyChanged("IndirectCostsMoney");
                    SendPropertyChanged("CostPrice");
                    SendPropertyChanged("ProfitMoney");
                    SendPropertyChanged("GrossSalesPrice");
                    SendPropertyChanged("SalesCostMoney");
                    SendPropertyChanged("NetSalesPrice");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");
                }
            }
        }
        #endregion

        #region OtherCashDiscountsMoney
        public double OtherCashDiscountsMoney
        {
            get { return VMMath.Round(InvoicePriceSupplier2 * (OtherCashDiscountsPercent / 100d)); }
        }
        #endregion


        #region PurchasePrice
        public double PurchasePrice
        {
            get { return VMMath.Round(InvoicePriceSupplier2 - OtherCashDiscountsMoney); }

        }
        #endregion

        #region PurchasingCostsPercent
        [DataMember]
        double _PurchasingCostsPercent = 0;
        public double PurchasingCostsPercent
        {
            get { return _PurchasingCostsPercent; }
            set
            {
                if (_PurchasingCostsPercent != value)
                {
                    _PurchasingCostsPercent = value;
                    SendPropertyChanged("PurchasingCostsPercent");
                    SendPropertyChanged("PurchasingCostsMoney");
                    SendPropertyChanged("AcquistitionPrice");
                    SendPropertyChanged("IndirectCostsMoney");
                    SendPropertyChanged("CostPrice");
                    SendPropertyChanged("ProfitMoney");
                    SendPropertyChanged("GrossSalesPrice");
                    SendPropertyChanged("SalesCostMoney");
                    SendPropertyChanged("NetSalesPrice");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");

                }
            }
        }
        #endregion

        #region PurchasingCostsMoney
        public double PurchasingCostsMoney
        {
            get { return VMMath.Round(PurchasePrice * (PurchasingCostsPercent / 100d)); }
        }
        #endregion

        #region AcquistitionPrice
        public double AcquistitionPrice
        {
            get { return VMMath.Round(PurchasePrice + PurchasingCostsMoney); }
        }
        #endregion

        #region IndirectCostsPercent
        [DataMember]
        double _IndirectCostsPercent = 0;
        public double IndirectCostsPercent
        {
            get { return _IndirectCostsPercent; }
            set
            {
                if (_IndirectCostsPercent != value)
                {
                    _IndirectCostsPercent = value;
                    SendPropertyChanged("IndirectCostsPercent");

                    SendPropertyChanged("IndirectCostsMoney");
                    SendPropertyChanged("CostPrice");
                    SendPropertyChanged("ProfitMoney");
                    SendPropertyChanged("GrossSalesPrice");
                    SendPropertyChanged("SalesCostMoney");
                    SendPropertyChanged("NetSalesPrice");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");
                }
            }
        }
        #endregion

        #region IndirectCostsMoney
        public double IndirectCostsMoney
        {
            get { return VMMath.Round(AcquistitionPrice * (IndirectCostsPercent / 100d)); }
        }
        #endregion


        #region CostPrice
        public double CostPrice
        {
            get { return VMMath.Round(AcquistitionPrice + IndirectCostsMoney); }
        }
        #endregion

        #region ProfitPercent
        [DataMember]
        double _ProfitPercent = 0;
        public double ProfitPercent
        {
            get { return _ProfitPercent; }
            set
            {
                if (_ProfitPercent != value)
                {
                    _ProfitPercent = value;
                    SendPropertyChanged("ProfitPercent");

                    SendPropertyChanged("ProfitMoney");
                    SendPropertyChanged("GrossSalesPrice");
                    SendPropertyChanged("SalesCostMoney");
                    SendPropertyChanged("NetSalesPrice");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");
                }
            }
        }
        #endregion

        #region ProfitMoney
        public double ProfitMoney
        {
            get { return VMMath.Round(CostPrice * (ProfitPercent / 100d)); }
        }
        #endregion

        #region GrossSalesPrice
        public double GrossSalesPrice
        {
            get { return VMMath.Round(CostPrice + ProfitMoney); }

        }
        #endregion

        #region SalesCostPercent
        [DataMember]
        double _SalesCostPercent = 0;
        public double SalesCostPercent
        {
            get { return _SalesCostPercent; }
            set
            {
                if (_SalesCostPercent != value)
                {
                    _SalesCostPercent = value;
                    SendPropertyChanged("SalesCostPercent");
                    SendPropertyChanged("SalesCostMoney");
                    SendPropertyChanged("NetSalesPrice");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");
                }
            }
        }
        #endregion

        #region SalesCostMoney
        public double SalesCostMoney
        {
            get { return VMMath.Round(GrossSalesPrice * (SalesCostPercent / 100d)); }
        }
        #endregion

        #region NetSalesPrice
        public double NetSalesPrice
        {
            get { return VMMath.Round(GrossSalesPrice + SalesCostMoney); }
        }
        #endregion

        #region CustomerCashDiscountPercent
        [DataMember]
        double _CustomerCashDiscountPercent = 0;
        public double CustomerCashDiscountPercent
        {
            get { return _CustomerCashDiscountPercent; }
            set
            {
                if (_CustomerCashDiscountPercent != value)
                {
                    _CustomerCashDiscountPercent = value;
                    SendPropertyChanged("CustomerCashDiscountPercent");
                    SendPropertyChanged("CustomerCashDiscountMoney");
                    SendPropertyChanged("InvoicePrice");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");
                }
            }
        }
        #endregion

        #region CustomerCashDiscountMoney
        public double CustomerCashDiscountMoney
        {
            get
            {
                //return VMMath.Round( NetSalesPrice * (CustomerCashDiscountPercent / 100d));
                return VMMath.Round((NetSalesPrice / (100d - CustomerCashDiscountPercent)) * CustomerDiscountPercent);
            }
        }
        #endregion


        #region InvoicePrice
        public double InvoicePrice
        {
            get { return VMMath.Round(NetSalesPrice + CustomerCashDiscountMoney); }
        }
        #endregion

        #region CustomerDiscountPercent
        [DataMember]
        double _CustomerDiscountPercent = 0;
        public double CustomerDiscountPercent
        {
            get { return _CustomerDiscountPercent; }
            set
            {
                if (_CustomerDiscountPercent != value)
                {
                    _CustomerDiscountPercent = value;
                    SendPropertyChanged("CustomerDiscountPercent");
                    SendPropertyChanged("CustomerDiscountMoney");
                    SendPropertyChanged("ListPriceSales");
                    SendPropertyChanged("CustomerCashDiscountMoney");

                }
            }
        }
        #endregion

        #region CustomerDiscountMoney
        public double CustomerDiscountMoney
        {
            get
            {
                return VMMath.Round((InvoicePrice / (100d - CustomerDiscountPercent)) * CustomerDiscountPercent);
                //return VMMath.Round( InvoicePrice * (CustomerDiscountPercent / 100d)); 
            }
        }
        #endregion

        #region ListPriceSales
        public double ListPriceSales
        {
            get { return VMMath.Round(InvoicePrice + CustomerDiscountMoney); }
        }
        #endregion

        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion
    }

    [DataContract]
    public class Step_BalanceAndOthers_Price : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region UI
        #region Step_BalanceAndOthers_Price_Header
        [DataMember]
        string _Step_BalanceAndOthers_Price_Header = string.Empty;
        public string Step_BalanceAndOthers_Price_Header
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_Price_Header))
                {
                    _Step_BalanceAndOthers_Price_Header = "Price Calculation";
                }
                return _Step_BalanceAndOthers_Price_Header;
            }
            set
            {
                if (_Step_BalanceAndOthers_Price_Header != value)
                {
                    _Step_BalanceAndOthers_Price_Header = value;
                    SendPropertyChanged("Step_BalanceAndOthers_Price_Header");
                }
            }
        }
        #endregion

        #region UIText_PreCalculation
        [DataMember]
        string _UIText_PreCalculation = string.Empty;
        public string UIText_PreCalculation
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_PreCalculation))
                {
                    _UIText_PreCalculation = "Pre Calculation";
                }
                return _UIText_PreCalculation;
            }
            set
            {
                if (_UIText_PreCalculation != value)
                {
                    _UIText_PreCalculation = value;
                    SendPropertyChanged("UIText_PreCalculation");
                }
            }
        }
        #endregion

        #region UIText_POSTCalculation
        [DataMember]
        string _UIText_POSTCalculation = string.Empty;
        public string UIText_POSTCalculation
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_POSTCalculation))
                {
                    _UIText_POSTCalculation = "Post Calculation";
                }
                return _UIText_POSTCalculation;
            }
            set
            {
                if (_UIText_POSTCalculation != value)
                {
                    _UIText_POSTCalculation = value;
                    SendPropertyChanged("UIText_POSTCalculation");
                }
            }
        }
        #endregion

        #region UIText_Order
        [DataMember]
        string _UIText_Order = string.Empty;
        public string UIText_Order
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Order))
                {
                    _UIText_Order = "Order:";
                }
                return _UIText_Order;
            }
            set
            {
                if (_UIText_Order != value)
                {
                    _UIText_Order = value;
                    SendPropertyChanged("UIText_Order");
                }
            }
        }
        #endregion

        #region UIText_Author
        [DataMember]
        string _UIText_Author = string.Empty;
        public string UIText_Author
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Author))
                {
                    _UIText_Author = "Author:";
                }
                return _UIText_Author;
            }
            set
            {
                if (_UIText_Author != value)
                {
                    _UIText_Author = value;
                    SendPropertyChanged("UIText_Author");
                }
            }
        }
        #endregion

        #region UIText_Date
        [DataMember]
        string _UIText_Date = string.Empty;
        public string UIText_Date
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Date))
                {
                    _UIText_Date = "Date:";
                }
                return _UIText_Date;
            }
            set
            {
                if (_UIText_Date != value)
                {
                    _UIText_Date = value;
                    SendPropertyChanged("UIText_Date");
                }
            }
        }
        #endregion

        #region UIText_MATERIAL
        [DataMember]
        string _UIText_MATERIAL = string.Empty;
        public string UIText_MATERIAL
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_MATERIAL))
                {
                    _UIText_MATERIAL = "MATERIAL";
                }
                return _UIText_MATERIAL;
            }
            set
            {
                if (_UIText_MATERIAL != value)
                {
                    _UIText_MATERIAL = value;
                    SendPropertyChanged("UIText_MATERIAL");
                }
            }
        }
        #endregion

        #region UIText_IndividualMaterial
        [DataMember]
        string _UIText_IndividualMaterial = string.Empty;
        public string UIText_IndividualMaterial
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_IndividualMaterial))
                {
                    _UIText_IndividualMaterial = "Individual material";
                }
                return _UIText_IndividualMaterial;
            }
            set
            {
                if (_UIText_IndividualMaterial != value)
                {
                    _UIText_IndividualMaterial = value;
                    SendPropertyChanged("UIText_IndividualMaterial");
                }
            }
        }
        #endregion

        #region UIText_Costs
        [DataMember]
        string _UIText_Costs = string.Empty;
        public string UIText_Costs
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Costs))
                {
                    _UIText_Costs = "Costs";
                }
                return _UIText_Costs;
            }
            set
            {
                if (_UIText_Costs != value)
                {
                    _UIText_Costs = value;
                    SendPropertyChanged("UIText_Costs");
                }
            }
        }
        #endregion

        #region UIText_MaterialOverheadCosts
        [DataMember]
        string _UIText_MaterialOverheadCosts = string.Empty;
        public string UIText_MaterialOverheadCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_MaterialOverheadCosts))
                {
                    _UIText_MaterialOverheadCosts = "Material overhead costs:";
                }
                return _UIText_MaterialOverheadCosts;
            }
            set
            {
                if (_UIText_MaterialOverheadCosts != value)
                {
                    _UIText_MaterialOverheadCosts = value;
                    SendPropertyChanged("UIText_MaterialOverheadCosts");
                }
            }
        }
        #endregion

        #region UIText_RatePercent
        [DataMember]
        string _UIText_RatePercent = string.Empty;
        public string UIText_RatePercent
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_RatePercent))
                {
                    _UIText_RatePercent = "rate %:";
                }
                return _UIText_RatePercent;
            }
            set
            {
                if (_UIText_RatePercent != value)
                {
                    _UIText_RatePercent = value;
                    SendPropertyChanged("UIText_RatePercent");
                }
            }
        }
        #endregion

        #region UIText_TotalMaterialCosts
        [DataMember]
        string _UIText_TotalMaterialCosts = string.Empty;
        public string UIText_TotalMaterialCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_TotalMaterialCosts))
                {
                    _UIText_TotalMaterialCosts = "Total Material costs";
                }
                return _UIText_TotalMaterialCosts;
            }
            set
            {
                if (_UIText_TotalMaterialCosts != value)
                {
                    _UIText_TotalMaterialCosts = value;
                    SendPropertyChanged("UIText_TotalMaterialCosts");
                }
            }
        }
        #endregion

        #region UIText_WAGES
        [DataMember]
        string _UIText_WAGES = string.Empty;
        public string UIText_WAGES
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_WAGES))
                {
                    _UIText_WAGES = "WAGES";
                }
                return _UIText_WAGES;
            }
            set
            {
                if (_UIText_WAGES != value)
                {
                    _UIText_WAGES = value;
                    SendPropertyChanged("UIText_WAGES");
                }
            }
        }
        #endregion

        #region UIText_DirectLaborCosts
        [DataMember]
        string _UIText_DirectLaborCosts = string.Empty;
        public string UIText_DirectLaborCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_DirectLaborCosts))
                {
                    _UIText_DirectLaborCosts = "Direct labor costs";
                }
                return _UIText_DirectLaborCosts;
            }
            set
            {
                if (_UIText_DirectLaborCosts != value)
                {
                    _UIText_DirectLaborCosts = value;
                    SendPropertyChanged("UIText_DirectLaborCosts");
                }
            }
        }
        #endregion

        #region UIText_Hours
        [DataMember]
        string _UIText_Hours = string.Empty;
        public string UIText_Hours
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Hours))
                {
                    _UIText_Hours = "hours";
                }
                return _UIText_Hours;
            }
            set
            {
                if (_UIText_Hours != value)
                {
                    _UIText_Hours = value;
                    SendPropertyChanged("UIText_Hours");
                }
            }
        }
        #endregion

        #region UIText_RatePecentPerHour
        [DataMember]
        string _UIText_RatePecentPerHour = string.Empty;
        public string UIText_RatePecentPerHour
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_RatePecentPerHour))
                {
                    _UIText_RatePecentPerHour = "rate % / $/h";
                }
                return _UIText_RatePecentPerHour;
            }
            set
            {
                if (_UIText_RatePecentPerHour != value)
                {
                    _UIText_RatePecentPerHour = value;
                    SendPropertyChanged("UIText_RatePecentPerHour");
                }
            }
        }
        #endregion

        #region UIText_WagesOverheadCosts
        [DataMember]
        string _UIText_WagesOverheadCosts = string.Empty;
        public string UIText_WagesOverheadCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_WagesOverheadCosts))
                {
                    _UIText_WagesOverheadCosts = "Wages overhead costs:";
                }
                return _UIText_WagesOverheadCosts;
            }
            set
            {
                if (_UIText_WagesOverheadCosts != value)
                {
                    _UIText_WagesOverheadCosts = value;
                    SendPropertyChanged("UIText_WagesOverheadCosts");
                }
            }
        }
        #endregion

        #region UIText_TotalCostsForWages
        [DataMember]
        string _UIText_TotalCostsForWages = string.Empty;
        public string UIText_TotalCostsForWages
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_TotalCostsForWages))
                {
                    _UIText_TotalCostsForWages = "Total Costs for wages:";
                }
                return _UIText_TotalCostsForWages;
            }
            set
            {
                if (_UIText_TotalCostsForWages != value)
                {
                    _UIText_TotalCostsForWages = value;
                    SendPropertyChanged("UIText_TotalCostsForWages");
                }
            }
        }
        #endregion

        #region UIText_DIRECTCOSTS
        [DataMember]
        string _UIText_DIRECTCOSTS = string.Empty;
        public string UIText_DIRECTCOSTS
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_DIRECTCOSTS))
                {
                    _UIText_DIRECTCOSTS = "DIRECT COSTS";
                }
                return _UIText_DIRECTCOSTS;
            }
            set
            {
                if (_UIText_DIRECTCOSTS != value)
                {
                    _UIText_DIRECTCOSTS = value;
                    SendPropertyChanged("UIText_DIRECTCOSTS");
                }
            }
        }
        #endregion

        #region UIText_UseOfMachinesAndEquipment
        [DataMember]
        string _UIText_UseOfMachinesAndEquipment = string.Empty;
        public string UIText_UseOfMachinesAndEquipment
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_UseOfMachinesAndEquipment))
                {
                    _UIText_UseOfMachinesAndEquipment = " (Use of machines and equipment)";
                }
                return _UIText_UseOfMachinesAndEquipment;
            }
            set
            {
                if (_UIText_UseOfMachinesAndEquipment != value)
                {
                    _UIText_UseOfMachinesAndEquipment = value;
                    SendPropertyChanged("UIText_UseOfMachinesAndEquipment");
                }
            }
        }
        #endregion

        #region UIText_IndividualDirectCosts
        [DataMember]
        string _UIText_IndividualDirectCosts = string.Empty;
        public string UIText_IndividualDirectCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_IndividualDirectCosts))
                {
                    _UIText_IndividualDirectCosts = "Individual DirectCosts";
                }
                return _UIText_IndividualDirectCosts;
            }
            set
            {
                if (_UIText_IndividualDirectCosts != value)
                {
                    _UIText_IndividualDirectCosts = value;
                    SendPropertyChanged("UIText_IndividualDirectCosts");
                }
            }
        }
        #endregion

        #region UIText_TotalDirectCosts
        [DataMember]
        string _UIText_TotalDirectCosts = string.Empty;
        public string UIText_TotalDirectCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_TotalDirectCosts))
                {
                    _UIText_TotalDirectCosts = "Total Direct Costs:";
                }
                return _UIText_TotalDirectCosts;
            }
            set
            {
                if (_UIText_TotalDirectCosts != value)
                {
                    _UIText_TotalDirectCosts = value;
                    SendPropertyChanged("UIText_TotalDirectCosts");
                }
            }
        }
        #endregion

        #region UIText_ProdutionCosts
        [DataMember]
        string _UIText_ProdutionCosts = string.Empty;
        public string UIText_ProdutionCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_ProdutionCosts))
                {
                    _UIText_ProdutionCosts = "Prodution Costs";
                }
                return _UIText_ProdutionCosts;
            }
            set
            {
                if (_UIText_ProdutionCosts != value)
                {
                    _UIText_ProdutionCosts = value;
                    SendPropertyChanged("UIText_ProdutionCosts");
                }
            }
        }
        #endregion

        #region UIText_GeneralCostsForManagementAndAdministration
        [DataMember]
        string _UIText_GeneralCostsForManagementAndAdministration = string.Empty;
        public string UIText_GeneralCostsForManagementAndAdministration
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_GeneralCostsForManagementAndAdministration))
                {
                    _UIText_GeneralCostsForManagementAndAdministration = "General costs for management and Administration";
                }
                return _UIText_GeneralCostsForManagementAndAdministration;
            }
            set
            {
                if (_UIText_GeneralCostsForManagementAndAdministration != value)
                {
                    _UIText_GeneralCostsForManagementAndAdministration = value;
                    SendPropertyChanged("UIText_GeneralCostsForManagementAndAdministration");
                }
            }
        }
        #endregion

        #region UIText_ThirdpartyWorks
        [DataMember]
        string _UIText_ThirdpartyWorks = string.Empty;
        public string UIText_ThirdpartyWorks
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_ThirdpartyWorks))
                {
                    _UIText_ThirdpartyWorks = "Thirdparty works";
                }
                return _UIText_ThirdpartyWorks;
            }
            set
            {
                if (_UIText_ThirdpartyWorks != value)
                {
                    _UIText_ThirdpartyWorks = value;
                    SendPropertyChanged("UIText_ThirdpartyWorks");
                }
            }
        }
        #endregion

        #region UIText_PrimeCosts
        [DataMember]
        string _UIText_PrimeCosts = string.Empty;
        public string UIText_PrimeCosts
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_PrimeCosts))
                {
                    _UIText_PrimeCosts = "Prime Costs";
                }
                return _UIText_PrimeCosts;
            }
            set
            {
                if (_UIText_PrimeCosts != value)
                {
                    _UIText_PrimeCosts = value;
                    SendPropertyChanged("UIText_PrimeCosts");
                }
            }
        }
        #endregion

        #region UIText_RiskAndProfit
        [DataMember]
        string _UIText_RiskAndProfit = string.Empty;
        public string UIText_RiskAndProfit
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_RiskAndProfit))
                {
                    _UIText_RiskAndProfit = "Risk and Profit";
                }
                return _UIText_RiskAndProfit;
            }
            set
            {
                if (_UIText_RiskAndProfit != value)
                {
                    _UIText_RiskAndProfit = value;
                    SendPropertyChanged("UIText_RiskAndProfit");
                }
            }
        }
        #endregion

        #region UIText_CalculatedPrice
        [DataMember]
        string _UIText_CalculatedPrice = string.Empty;
        public string UIText_CalculatedPrice
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_CalculatedPrice))
                {
                    _UIText_CalculatedPrice = "Calculated Price";
                }
                return _UIText_CalculatedPrice;
            }
            set
            {
                if (_UIText_CalculatedPrice != value)
                {
                    _UIText_CalculatedPrice = value;
                    SendPropertyChanged("UIText_CalculatedPrice");
                }
            }
        }
        #endregion

        #region UIText_ValueAddedTax
        [DataMember]
        string _UIText_ValueAddedTax = string.Empty;
        public string UIText_ValueAddedTax
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_ValueAddedTax))
                {
                    _UIText_ValueAddedTax = "Value added tax";
                }
                return _UIText_ValueAddedTax;
            }
            set
            {
                if (_UIText_ValueAddedTax != value)
                {
                    _UIText_ValueAddedTax = value;
                    SendPropertyChanged("UIText_ValueAddedTax");
                }
            }
        }
        #endregion

        #region UIText_SALSEPRICE
        [DataMember]
        string _UIText_SALSEPRICE = string.Empty;
        public string UIText_SALSEPRICE
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_SALSEPRICE))
                {
                    _UIText_SALSEPRICE = "SALSE PRICE";
                }
                return _UIText_SALSEPRICE;
            }
            set
            {
                if (_UIText_SALSEPRICE != value)
                {
                    _UIText_SALSEPRICE = value;
                    SendPropertyChanged("UIText_SALSEPRICE");
                }
            }
        }
        #endregion
        #endregion


        public string CompanyName { get { return ProjectData.Intance.CompanyName; } }
        #region IsPreCalculation
        [DataMember]
        bool _IsPreCalculation = true;
        public bool IsPreCalculation
        {
            get { return _IsPreCalculation; }
            set
            {
                if (_IsPreCalculation != value)
                {
                    _IsPreCalculation = value;
                    SendPropertyChanged("IsPreCalculation");
                    SendPropertyChanged("IsPostCalculation");
                }
            }
        }
        public bool IsPostCalculation
        {
            get { return !_IsPreCalculation; }
            set
            {
                if (_IsPreCalculation == value)
                {
                    _IsPreCalculation = !value;
                    SendPropertyChanged("IsPostCalculation");
                    SendPropertyChanged("IsPreCalculation");
                }
            }
        }

        #endregion

        #region Order
        [DataMember]
        string _Order = string.Empty;
        public string Order
        {
            get { return _Order; }
            set
            {
                if (_Order != value)
                {
                    _Order = value;
                    SendPropertyChanged("Order");
                }
            }
        }
        #endregion

        #region Author
        [DataMember]
        string _Author = string.Empty;
        public string Author
        {
            get { return _Author; }
            set
            {
                if (_Author != value)
                {
                    _Author = value;
                    SendPropertyChanged("Author");
                }
            }
        }
        #endregion

        #region Date
        [DataMember]
        DateTime _Date = DateTime.Now;
        public DateTime Date
        {
            get { return _Date; }
            set
            {
                if (_Date != value)
                {
                    _Date = value;
                    SendPropertyChanged("Date");
                }
            }
        }
        #endregion

        #region Material
        #region MaterialItems
        [DataMember]
        List<Step_BalanceAndOthers_Price_Material> _MaterialItems = null;
        public Step_BalanceAndOthers_Price_Material[] MaterialItems
        {
            get
            {
                if (_MaterialItems == null)
                    _MaterialItems = new List<Step_BalanceAndOthers_Price_Material>();
                if (_MaterialItems.Count == 0)
                    AddMaterialItems(new Step_BalanceAndOthers_Price_Material());
                return _MaterialItems.ToArray();
            }
        }
        public void AddMaterialItems(Step_BalanceAndOthers_Price_Material newItem)
        {
            if (_MaterialItems == null)
                _MaterialItems = new List<Step_BalanceAndOthers_Price_Material>();
            _MaterialItems.Add(newItem);
            SendPropertyChanged("MaterialItems");
            newItem.PropertyChanged -= new PropertyChangedEventHandler(MaterialItems_newItem_PropertyChanged);
            newItem.PropertyChanged += new PropertyChangedEventHandler(MaterialItems_newItem_PropertyChanged);
        }

        void MaterialItems_newItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            SendPropertyChanged("Material_RatePercent");
            SendPropertyChanged("MaterialOverHeadCosts");
            SendPropertyChanged("TotalMaterialCosts");
            SendPropertyChanged("ProdutionCosts");
            SendPropertyChanged("GeneralCosts");
            SendPropertyChanged("RiskAndProfitCosts");
            SendPropertyChanged("ValueAddedTaxCosts");
            SendPropertyChanged("SalesPrice");
            SendPropertyChanged("PrimeCosts");
            SendPropertyChanged("CalculatedPrice");
        }
        public void RemoveMaterialItems(Step_BalanceAndOthers_Price_Material removeItem)
        {
            if (_MaterialItems == null)
                _MaterialItems = new List<Step_BalanceAndOthers_Price_Material>();
            if (_MaterialItems.Count() == 1)
            {
                removeItem.IndividualMaterial = string.Empty;
                removeItem.Costs = 0;
            }
            else
            {
                this._MaterialItems.Remove(removeItem);
            }
            SendPropertyChanged("MaterialItems");
        }
        #endregion

        #region Material_RatePercent
        [DataMember]
        double _Material_RatePercent = 0;
        public double Material_RatePercent
        {
            get { return _Material_RatePercent; }
            set
            {
                if (_Material_RatePercent != value)
                {
                    _Material_RatePercent = value;
                    SendPropertyChanged("Material_RatePercent");
                    SendPropertyChanged("MaterialOverHeadCosts");
                    SendPropertyChanged("TotalMaterialCosts");
                    SendPropertyChanged("ProdutionCosts");
                    SendPropertyChanged("GeneralCosts");
                    SendPropertyChanged("RiskAndProfitCosts");
                    SendPropertyChanged("ValueAddedTaxCosts");
                    SendPropertyChanged("SalesPrice");
                    SendPropertyChanged("PrimeCosts");
                    SendPropertyChanged("CalculatedPrice");
                }
            }
        }
        #endregion

        public double MaterialOverHeadCosts
        {
            get
            {
                if (MaterialItems == null || MaterialItems.Length == 0)
                    return 0;
                return VMMath.Round(MaterialItems.Sum(c => c.Costs) * Material_RatePercent / 100d);
            }
        }
        public double TotalMaterialCosts
        {
            get
            {
                if (MaterialItems == null || MaterialItems.Length == 0)
                    return 0;
                return VMMath.Round(MaterialItems.Sum(c => c.Costs) + MaterialOverHeadCosts);
            }
        }
        #endregion

        #region Wages
        #region WagesItems
        [DataMember]
        List<Step_BalanceAndOthers_Price_Wages> _WagesItems = null;
        public Step_BalanceAndOthers_Price_Wages[] WagesItems
        {
            get
            {
                if (_WagesItems == null)
                    _WagesItems = new List<Step_BalanceAndOthers_Price_Wages>();
                if (_WagesItems.Count == 0)
                    AddWagesItems(new Step_BalanceAndOthers_Price_Wages());
                return _WagesItems.ToArray();
            }
        }
        public void AddWagesItems(Step_BalanceAndOthers_Price_Wages newItem)
        {
            if (_WagesItems == null)
                _WagesItems = new List<Step_BalanceAndOthers_Price_Wages>();
            _WagesItems.Add(newItem);
            SendPropertyChanged("WagesItems");
            newItem.PropertyChanged -= new PropertyChangedEventHandler(WagesItems_newItem_PropertyChanged);
            newItem.PropertyChanged += new PropertyChangedEventHandler(WagesItems_newItem_PropertyChanged);
        }

        void WagesItems_newItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            SendPropertyChanged("Wages_RatePercent");
            SendPropertyChanged("WagesOverHeadCosts");
            SendPropertyChanged("TotalWagesCosts");
            SendPropertyChanged("ProdutionCosts");
            SendPropertyChanged("GeneralCosts");
            SendPropertyChanged("RiskAndProfitCosts");
            SendPropertyChanged("ValueAddedTaxCosts");
            SendPropertyChanged("SalesPrice");
            SendPropertyChanged("PrimeCosts");
            SendPropertyChanged("CalculatedPrice");
        }
        public void RemoveWagesItems(Step_BalanceAndOthers_Price_Wages removeItem)
        {
            if (_WagesItems == null)
                _WagesItems = new List<Step_BalanceAndOthers_Price_Wages>();
            if (_WagesItems.Count() == 1)
            {
                removeItem.DirectLaborCosts = string.Empty;
                removeItem.RatePerHour = 0;
                removeItem.Hours = 0;
            }
            else
            {
                this._WagesItems.Remove(removeItem);
            }
            SendPropertyChanged("WagesItems");
        }
        #endregion

        #region Wages_RatePercent
        [DataMember]
        double _Wages_RatePercent = 0;
        public double Wages_RatePercent
        {
            get { return _Wages_RatePercent; }
            set
            {
                if (_Wages_RatePercent != value)
                {
                    _Wages_RatePercent = value;
                    SendPropertyChanged("Wages_RatePercent");
                    SendPropertyChanged("WagesOverHeadCosts");
                    SendPropertyChanged("TotalWagesCosts");
                    SendPropertyChanged("ProdutionCosts");
                    SendPropertyChanged("GeneralCosts");
                    SendPropertyChanged("RiskAndProfitCosts");
                    SendPropertyChanged("ValueAddedTaxCosts");
                    SendPropertyChanged("SalesPrice");
                    SendPropertyChanged("PrimeCosts");
                    SendPropertyChanged("CalculatedPrice");
                }
            }
        }
        #endregion

        public double WagesOverHeadCosts
        {
            get
            {
                if (WagesItems == null || WagesItems.Length == 0)
                    return 0;
                return VMMath.Round(WagesItems.Sum(c => c.Costs) * Wages_RatePercent / 100d);
            }
        }
        public double TotalWagesCosts
        {
            get
            {
                if (WagesItems == null || WagesItems.Length == 0)
                    return 0;
                return VMMath.Round(WagesItems.Sum(c => c.Costs) + WagesOverHeadCosts);
            }
        }
        #endregion

        #region DirectCosts
        #region DirectCostsItems
        [DataMember]
        List<Step_BalanceAndOthers_Price_DirectCosts> _DirectCostsItems = null;
        public Step_BalanceAndOthers_Price_DirectCosts[] DirectCostsItems
        {
            get
            {
                if (_DirectCostsItems == null)
                    _DirectCostsItems = new List<Step_BalanceAndOthers_Price_DirectCosts>();
                if (_DirectCostsItems.Count == 0)
                    AddDirectCostsItems(new Step_BalanceAndOthers_Price_DirectCosts());
                return _DirectCostsItems.ToArray();
            }
        }
        public void AddDirectCostsItems(Step_BalanceAndOthers_Price_DirectCosts newItem)
        {
            if (_DirectCostsItems == null)
                _DirectCostsItems = new List<Step_BalanceAndOthers_Price_DirectCosts>();
            _DirectCostsItems.Add(newItem);
            SendPropertyChanged("DirectCostsItems");
            newItem.PropertyChanged -= new PropertyChangedEventHandler(DirectCostsItems_newItem_PropertyChanged);
            newItem.PropertyChanged += new PropertyChangedEventHandler(DirectCostsItems_newItem_PropertyChanged);
        }

        void DirectCostsItems_newItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            SendPropertyChanged("DirectCosts_RatePercent");
            SendPropertyChanged("DirectCostsOverHeadCosts");
            SendPropertyChanged("TotalDirectCostsCosts");
            SendPropertyChanged("ProdutionCosts");
            SendPropertyChanged("GeneralCosts");
            SendPropertyChanged("RiskAndProfitCosts");
            SendPropertyChanged("ValueAddedTaxCosts");
            SendPropertyChanged("SalesPrice");
            SendPropertyChanged("PrimeCosts");
            SendPropertyChanged("CalculatedPrice");
        }
        public void RemoveDirectCostsItems(Step_BalanceAndOthers_Price_DirectCosts removeItem)
        {
            if (_DirectCostsItems == null)
                _DirectCostsItems = new List<Step_BalanceAndOthers_Price_DirectCosts>();
            if (_DirectCostsItems.Count() == 1)
            {
                removeItem.IndividualDirectCosts = string.Empty;
                removeItem.Hours = 0;
                removeItem.RatePerHour = 0;
            }
            else
            {
                this._DirectCostsItems.Remove(removeItem);
            }
            SendPropertyChanged("DirectCostsItems");
        }
        #endregion

        #region DirectCosts_RatePercent
        [DataMember]
        double _DirectCosts_RatePercent = 0;
        public double DirectCosts_RatePercent
        {
            get { return _DirectCosts_RatePercent; }
            set
            {
                if (_DirectCosts_RatePercent != value)
                {
                    _DirectCosts_RatePercent = value;
                    SendPropertyChanged("DirectCosts_RatePercent");
                    SendPropertyChanged("DirectCostsOverHeadCosts");
                    SendPropertyChanged("TotalDirectCostsCosts");
                    SendPropertyChanged("ProdutionCosts");
                    SendPropertyChanged("GeneralCosts");
                    SendPropertyChanged("RiskAndProfitCosts");
                    SendPropertyChanged("ValueAddedTaxCosts");
                    SendPropertyChanged("SalesPrice");
                    SendPropertyChanged("PrimeCosts");
                    SendPropertyChanged("CalculatedPrice");
                }
            }
        }
        #endregion

        public double DirectCostsOverHeadCosts
        {
            get
            {
                if (DirectCostsItems == null || DirectCostsItems.Length == 0)
                    return 0;
                return VMMath.Round(DirectCostsItems.Sum(c => c.Costs) * DirectCosts_RatePercent / 100d);
            }
        }
        public double TotalDirectCostsCosts
        {
            get
            {
                if (DirectCostsItems == null || DirectCostsItems.Length == 0)
                    return 0;
                return VMMath.Round(DirectCostsItems.Sum(c => c.Costs) + DirectCostsOverHeadCosts);
            }
        }
        #endregion

        #region ProdutionCosts
        public double ProdutionCosts
        {
            get { return VMMath.Round(TotalDirectCostsCosts + TotalMaterialCosts + TotalWagesCosts); }
        }
        #endregion

        #region General Costs
        #region General_RatePercent
        [DataMember]
        double _General_RatePercent = 0;
        public double General_RatePercent
        {
            get { return _General_RatePercent; }
            set
            {
                if (_General_RatePercent != value)
                {
                    _General_RatePercent = value;
                    SendPropertyChanged("General_RatePercent");
                    SendPropertyChanged("GeneralCosts");
                    SendPropertyChanged("RiskAndProfitCosts");
                    SendPropertyChanged("ValueAddedTaxCosts");
                    SendPropertyChanged("SalesPrice");
                    SendPropertyChanged("PrimeCosts");
                    SendPropertyChanged("CalculatedPrice");
                }
            }
        }
        #endregion
        public double GeneralCosts
        {
            get { return VMMath.Round(ProdutionCosts * General_RatePercent / 100d); }
        }
        #endregion

        #region Thirdparty works
        #region ThirdpartyWorks
        [DataMember]
        double _ThirdpartyWorks = 0;
        public double ThirdpartyWorks
        {
            get { return _ThirdpartyWorks; }
            set
            {
                if (_ThirdpartyWorks != value)
                {
                    _ThirdpartyWorks = value;
                    SendPropertyChanged("ThirdpartyWorks");
                    SendPropertyChanged("RiskAndProfitCosts");
                    SendPropertyChanged("ValueAddedTaxCosts");
                    SendPropertyChanged("SalesPrice");
                    SendPropertyChanged("PrimeCosts");
                    SendPropertyChanged("CalculatedPrice");
                }
            }
        }
        #endregion
        #endregion

        #region PrimeCosts
        public double PrimeCosts
        {
            get { return VMMath.Round(ProdutionCosts + GeneralCosts + ThirdpartyWorks); }
        }
        #endregion

        #region RiskAndProfit
        #region RiskAndProfit_RatePercent
        [DataMember]
        double _RiskAndProfit_RatePercent = 0;
        public double RiskAndProfit_RatePercent
        {
            get { return _RiskAndProfit_RatePercent; }
            set
            {
                if (_RiskAndProfit_RatePercent != value)
                {
                    _RiskAndProfit_RatePercent = value;
                    SendPropertyChanged("RiskAndProfit_RatePercent");
                    SendPropertyChanged("RiskAndProfitCosts");
                    SendPropertyChanged("PrimeCosts");
                    SendPropertyChanged("CalculatedPrice");
                    SendPropertyChanged("ValueAddedTaxCosts");
                    SendPropertyChanged("SalesPrice");
                }
            }
        }
        #endregion
        public double RiskAndProfitCosts
        {
            get { return VMMath.Round(PrimeCosts * RiskAndProfit_RatePercent / 100d); }
        }
        #endregion

        #region CalculatedPrice
        public double CalculatedPrice
        {
            get { return VMMath.Round(PrimeCosts + RiskAndProfitCosts); }
        }
        #endregion

        #region ValueAddedTax
        #region ValueAddedTax_RatePercent
        [DataMember]
        double _ValueAddedTax_RatePercent = 0;
        public double ValueAddedTax_RatePercent
        {
            get { return _ValueAddedTax_RatePercent; }
            set
            {
                if (_ValueAddedTax_RatePercent != value)
                {
                    _ValueAddedTax_RatePercent = value;
                    SendPropertyChanged("ValueAddedTax_RatePercent");
                    SendPropertyChanged("ValueAddedTaxCosts");
                    SendPropertyChanged("SalesPrice");
                }
            }
        }
        #endregion
        public double ValueAddedTaxCosts
        {
            get { return VMMath.Round(CalculatedPrice * ValueAddedTax_RatePercent / 100d); }
        }
        #endregion

        #region SalesPrice
        public double SalesPrice
        {
            get { return VMMath.Round(CalculatedPrice + ValueAddedTaxCosts); }
        }
        #endregion

        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion
    }
    [DataContract]
    public class Step_BalanceAndOthers_Price_Material : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        public string CompanyName { get { return ProjectData.Intance.CompanyName; } }
        #region IndividualMaterial
        [DataMember]
        string _IndividualMaterial = string.Empty;
        public string IndividualMaterial
        {
            get { return _IndividualMaterial; }
            set
            {
                if (_IndividualMaterial != value)
                {
                    _IndividualMaterial = value;
                    SendPropertyChanged("IndividualMaterial");
                }
            }
        }
        #endregion

        #region Costs
        [DataMember]
        double _Costs = 0;
        public double Costs
        {
            get { return _Costs; }
            set
            {
                if (_Costs != value)
                {
                    _Costs = value;
                    SendPropertyChanged("Costs");
                }
            }
        }
        #endregion

        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion
    }
    [DataContract]
    public class Step_BalanceAndOthers_Price_Wages : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region DirectLaborCosts
        [DataMember]
        string _DirectLaborCosts = string.Empty;
        public string DirectLaborCosts
        {
            get { return _DirectLaborCosts; }
            set
            {
                if (_DirectLaborCosts != value)
                {
                    _DirectLaborCosts = value;
                    SendPropertyChanged("DirectLaborCosts");
                }
            }
        }
        #endregion

        #region Hours
        [DataMember]
        double _Hours = 0;
        public double Hours
        {
            get { return _Hours; }
            set
            {
                if (_Hours != value)
                {
                    _Hours = value;
                    SendPropertyChanged("Hours");
                    SendPropertyChanged("Costs");
                }
            }
        }
        #endregion

        #region RatePerHour
        [DataMember]
        double _RatePerHour = 0;
        public double RatePerHour
        {
            get { return _RatePerHour; }
            set
            {
                if (_RatePerHour != value)
                {
                    _RatePerHour = value;
                    SendPropertyChanged("RatePerHour");
                    SendPropertyChanged("Costs");
                }
            }
        }
        #endregion

        #region Costs
        public double Costs
        {
            get { return VMMath.Round(Hours * RatePerHour); }
        }
        #endregion

        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion
    }
    [DataContract]
    public class Step_BalanceAndOthers_Price_DirectCosts : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region IndividualDirectCosts
        [DataMember]
        string _IndividualDirectCosts = string.Empty;
        public string IndividualDirectCosts
        {
            get { return _IndividualDirectCosts; }
            set
            {
                if (_IndividualDirectCosts != value)
                {
                    _IndividualDirectCosts = value;
                    SendPropertyChanged("IndividualDirectCosts");
                }
            }
        }
        #endregion

        #region Hours
        [DataMember]
        double _Hours = 0;
        public double Hours
        {
            get { return _Hours; }
            set
            {
                if (_Hours != value)
                {
                    _Hours = value;
                    SendPropertyChanged("Hours");
                    SendPropertyChanged("Costs");
                }
            }
        }
        #endregion

        #region RatePerHour
        [DataMember]
        double _RatePerHour = 0;
        public double RatePerHour
        {
            get { return _RatePerHour; }
            set
            {
                if (_RatePerHour != value)
                {
                    _RatePerHour = value;
                    SendPropertyChanged("RatePerHour");
                    SendPropertyChanged("Costs");
                }
            }
        }
        #endregion

        #region Costs
        public double Costs
        {
            get { return VMMath.Round(Hours * RatePerHour); }
        }
        #endregion

        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion
    }

    [DataContract]
    public class Step_BalanceAndOthers_InvestmentPlan : INotifyPropertyChanged
    {
        public Step_BalanceAndOthers_InvestmentPlan()
        {
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_InvestmentPlan_Item>();
        }
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        public string CompanyName { get { return ProjectData.Intance.CompanyName; } }
        #region UI
        #region Step_BalanceAndOthers_InvestmentPlan_Header
        [DataMember]
        string _Step_BalanceAndOthers_InvestmentPlan_Header = string.Empty;
        public string Step_BalanceAndOthers_InvestmentPlan_Header
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_InvestmentPlan_Header))
                {
                    _Step_BalanceAndOthers_InvestmentPlan_Header = "Investment plan";
                }
                return _Step_BalanceAndOthers_InvestmentPlan_Header;
            }
            set
            {
                if (_Step_BalanceAndOthers_InvestmentPlan_Header != value)
                {
                    _Step_BalanceAndOthers_InvestmentPlan_Header = value;
                    SendPropertyChanged("Step_BalanceAndOthers_InvestmentPlan_Header");
                }
            }
        }
        #endregion

        #region UIText_InvestmentsForMachinery
        [DataMember]
        string _UIText_InvestmentsForMachinery = string.Empty;
        public string UIText_InvestmentsForMachinery
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_InvestmentsForMachinery))
                {
                    _UIText_InvestmentsForMachinery = "Buy machinery, movable goods, IT, real estate, buildings… ";
                }
                return _UIText_InvestmentsForMachinery;
            }
            set
            {
                if (_UIText_InvestmentsForMachinery != value)
                {
                    _UIText_InvestmentsForMachinery = value;
                    SendPropertyChanged("UIText_InvestmentsForMachinery");
                }
            }
        }
        #endregion

        #region UIText_SellMachinery
        [DataMember]
        string _UIText_SellMachinery = string.Empty;
        public string UIText_SellMachinery
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_SellMachinery))
                {
                    _UIText_SellMachinery = "Sell machinery, movable goods, IT, real estate, buildings…";
                }
                return _UIText_SellMachinery;
            }
            set
            {
                if (_UIText_SellMachinery != value)
                {
                    _UIText_SellMachinery = value;
                    SendPropertyChanged("UIText_SellMachinery");
                }
            }
        }
        #endregion

        #region UIText_Total
        [DataMember]
        string _UIText_Total = string.Empty;
        public string UIText_Total
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total))
                {
                    _UIText_Total = "Total";
                }
                return _UIText_Total;
            }
            set
            {
                if (_UIText_Total != value)
                {
                    _UIText_Total = value;
                    SendPropertyChanged("UIText_Total");
                }
            }
        }
        #endregion

        #region UIText_Value
        [DataMember]
        string _UIText_Value = string.Empty;
        public string UIText_Value
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Value))
                {
                    _UIText_Value = "Value";
                }
                return _UIText_Value;
            }
            set
            {
                if (_UIText_Value != value)
                {
                    _UIText_Value = value;
                    SendPropertyChanged("UIText_Value");
                }
            }
        }
        #endregion

        #region UIText_TimeOfInvestment
        [DataMember]
        string _UIText_TimeOfInvestment = string.Empty;
        public string UIText_TimeOfInvestment
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_TimeOfInvestment))
                {
                    _UIText_TimeOfInvestment = "Time of investment";
                }
                return _UIText_TimeOfInvestment;
            }
            set
            {
                if (_UIText_TimeOfInvestment != value)
                {
                    _UIText_TimeOfInvestment = value;
                    SendPropertyChanged("UIText_TimeOfInvestment ");
                }
            }
        }
        #endregion

        #region UIText_Year1
        [DataMember]
        string _UIText_Year1 = string.Empty;
        public string UIText_Year1
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year1))
                {
                    _UIText_Year1 = "Year 1";
                }
                return _UIText_Year1;
            }
            set
            {
                if (_UIText_Year1 != value)
                {
                    _UIText_Year1 = value;
                    SendPropertyChanged("UIText_Year1");
                }
            }
        }
        #endregion

        #region UIText_Year2
        [DataMember]
        string _UIText_Year2 = string.Empty;
        public string UIText_Year2
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year2))
                {
                    _UIText_Year2 = "Year 2";
                }
                return _UIText_Year2;
            }
            set
            {
                if (_UIText_Year2 != value)
                {
                    _UIText_Year2 = value;
                    SendPropertyChanged("UIText_Year2");
                }
            }
        }
        #endregion

        #region UIText_Year3
        [DataMember]
        string _UIText_Year3 = string.Empty;
        public string UIText_Year3
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year3))
                {
                    _UIText_Year3 = "Year 3";
                }
                return _UIText_Year3;
            }
            set
            {
                if (_UIText_Year3 != value)
                {
                    _UIText_Year3 = value;
                    SendPropertyChanged("UIText_Year3");
                }
            }
        }
        #endregion

        #region UIText_Year4
        [DataMember]
        string _UIText_Year4 = string.Empty;
        public string UIText_Year4
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year4))
                {
                    _UIText_Year4 = "Year 4";
                }
                return _UIText_Year4;
            }
            set
            {
                if (_UIText_Year4 != value)
                {
                    _UIText_Year4 = value;
                    SendPropertyChanged("UIText_Year4");
                }
            }
        }
        #endregion

        #region UIText_Year5
        [DataMember]
        string _UIText_Year5 = string.Empty;
        public string UIText_Year5
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year5))
                {
                    _UIText_Year5 = "Year 5";
                }
                return _UIText_Year5;
            }
            set
            {
                if (_UIText_Year5 != value)
                {
                    _UIText_Year5 = value;
                    SendPropertyChanged("UIText_Year5");
                }
            }
        }
        #endregion

        #region UIText_UseFor
        [DataMember]
        string _UIText_UseFor = string.Empty;
        public string UIText_UseFor
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_UseFor))
                {
                    _UIText_UseFor = "Use for";
                }
                return _UIText_UseFor;
            }
            set
            {
                if (_UIText_UseFor != value)
                {
                    _UIText_UseFor = value;
                    SendPropertyChanged("UIText_UseFor");
                }
            }
        }
        #endregion

        #region UIText_FinancingMethod
        [DataMember]
        string _UIText_FinancingMethod = string.Empty;
        public string UIText_FinancingMethod
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_FinancingMethod))
                {
                    _UIText_FinancingMethod = "Financing method";
                }
                return _UIText_FinancingMethod;
            }
            set
            {
                if (_UIText_FinancingMethod != value)
                {
                    _UIText_FinancingMethod = value;
                    SendPropertyChanged("UIText_FinancingMethod");
                }
            }
        }
        #endregion

        #region UIText_AdditionalRemark
        [DataMember]
        string _UIText_AdditionalRemark = string.Empty;
        public string UIText_AdditionalRemark
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_AdditionalRemark))
                {
                    _UIText_AdditionalRemark = "Additional remark";
                }
                return _UIText_AdditionalRemark;
            }
            set
            {
                if (_UIText_AdditionalRemark != value)
                {
                    _UIText_AdditionalRemark = value;
                    SendPropertyChanged("UIText_AdditionalRemark");
                }
            }
        }
        #endregion
        #endregion

        #region Data
        public void RefreshData()
        {
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_InvestmentPlan_Item>();
            var _items = Items;
            foreach (var item in _items)
            {
                if (item != null)
                {
                    if (item.Parent != this)
                        item.Parent = this;
                }
            }
        }
        [DataMember]
        public List<Step_BalanceAndOthers_InvestmentPlan_Item> Items { get; set; }
        public Step_BalanceAndOthers_InvestmentPlan_Item[] Items_INVESTMENT
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_InvestmentPlan_Item[0] : Items.Where(c => c.GroupName == GROUP_INVESTMENT).ToArray();
            }
            set { }
        }
        public Step_BalanceAndOthers_InvestmentPlan_Item[] Items_SELL
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_InvestmentPlan_Item[0] : Items.Where(c => c.GroupName == GROUP_SELL).ToArray();
            }
            set { }
        }
        public double Total_Investment
        {
            get { return Items_INVESTMENT.Sum(c => c.Value); }
        }
        public double Total_Sell
        {
            get { return Items_SELL.Sum(c => c.Value); }
        }
        public string GROUP_INVESTMENT
        {
            get { return "INVESTMENT"; }
        }
        public string GROUP_SELL
        {
            get { return "SELL"; }
        }
        public void SendPropertyChanged_Total()
        {
            SendPropertyChanged("Total_Investment");
            SendPropertyChanged("Total_Sell");
        }

        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion
        #endregion

        #region Add
        public void AddNew(string group)
        {
            Step_BalanceAndOthers_InvestmentPlan_Item newItem = new Step_BalanceAndOthers_InvestmentPlan_Item(this)
            {
                GroupName = group,
            };
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_InvestmentPlan_Item>();
            Items.Add(newItem);
        }
        public void Remove(Step_BalanceAndOthers_InvestmentPlan_Item removeItem)
        {
            var grps = this.Items.Where(c => c.GroupName == removeItem.GroupName);
            if (grps.Count() == 1)
            {
                removeItem.Name = string.Empty;
                removeItem.Value = 0;
                removeItem.Year1 = string.Empty;
                removeItem.Year2 = string.Empty;
                removeItem.Year3 = string.Empty;
                removeItem.Year4 = string.Empty;
                removeItem.Year5 = string.Empty;
                removeItem.UseFor = string.Empty;
                removeItem.FinancingMethod = string.Empty;
                removeItem.AdditionalRemark = string.Empty;
            }
            else
            {
                this.Items.Remove(removeItem);
            }
        }
        #endregion


    }
    [DataContract]
    public class Step_BalanceAndOthers_InvestmentPlan_Item : INotifyPropertyChanged
    {
        Step_BalanceAndOthers_InvestmentPlan _Parent;
        public Step_BalanceAndOthers_InvestmentPlan Parent
        {
            get { return _Parent; }
            set
            {
                if (value != _Parent)
                {
                    _Parent = value;
                    this.PropertyChanged -= new PropertyChangedEventHandler(Step_BalanceAndOthers_InvestmentPlan_Item_PropertyChanged);
                    this.PropertyChanged += new PropertyChangedEventHandler(Step_BalanceAndOthers_InvestmentPlan_Item_PropertyChanged);
                }
            }
        }
        public Step_BalanceAndOthers_InvestmentPlan_Item(Step_BalanceAndOthers_InvestmentPlan parent)
        {
            Parent = parent;
        }


        void Step_BalanceAndOthers_InvestmentPlan_Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (Parent != null)
                Parent.SendPropertyChanged_Total();
        }

        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region Data
        #region GroupName
        [DataMember]
        string _GroupName = string.Empty;
        public string GroupName
        {
            get
            {
                return _GroupName;
            }
            set
            {
                if (_GroupName != value)
                {
                    _GroupName = value;
                    SendPropertyChanged("GroupName");
                }
            }
        }
        #endregion

        #region Name
        [DataMember]
        string _Name = string.Empty;
        public string Name
        {
            get
            {
                return _Name;
            }
            set
            {
                if (_Name != value)
                {
                    _Name = value;
                    SendPropertyChanged("Name");
                }
            }
        }
        #endregion

        #region Value
        [DataMember]
        double _Value = 0;
        public double Value
        {
            get
            {
                return _Value;
            }
            set
            {
                if (_Value != value)
                {
                    _Value = value;
                    SendPropertyChanged("Value");
                }
            }
        }
        #endregion

        #region Year1
        [DataMember]
        string _Year1 = string.Empty;
        public string Year1
        {
            get
            {
                return _Year1;
            }
            set
            {
                if (_Year1 != value)
                {
                    _Year1 = value;
                    SendPropertyChanged("Year1");
                }
            }
        }
        #endregion

        #region Year2
        [DataMember]
        string _Year2 = string.Empty;
        public string Year2
        {
            get
            {
                return _Year2;
            }
            set
            {
                if (_Year2 != value)
                {
                    _Year2 = value;
                    SendPropertyChanged("Year2");
                }
            }
        }
        #endregion

        #region Year3
        [DataMember]
        string _Year3 = string.Empty;
        public string Year3
        {
            get
            {
                return _Year3;
            }
            set
            {
                if (_Year3 != value)
                {
                    _Year3 = value;
                    SendPropertyChanged("Year3");
                }
            }
        }
        #endregion

        #region Year4
        [DataMember]
        string _Year4 = string.Empty;
        public string Year4
        {
            get
            {
                return _Year4;
            }
            set
            {
                if (_Year4 != value)
                {
                    _Year4 = value;
                    SendPropertyChanged("Year4");
                }
            }
        }
        #endregion

        #region Year5
        [DataMember]
        string _Year5 = string.Empty;
        public string Year5
        {
            get
            {
                return _Year5;
            }
            set
            {
                if (_Year5 != value)
                {
                    _Year5 = value;
                    SendPropertyChanged("Year5");
                }
            }
        }
        #endregion

        #region UseFor
        [DataMember]
        string _UseFor = string.Empty;
        public string UseFor
        {
            get
            {
                return _UseFor;
            }
            set
            {
                if (_UseFor != value)
                {
                    _UseFor = value;
                    SendPropertyChanged("UseFor");
                }
            }
        }
        #endregion

        #region FinancingMethod
        [DataMember]
        string _FinancingMethod = string.Empty;
        public string FinancingMethod
        {
            get
            {
                return _FinancingMethod;
            }
            set
            {
                if (_FinancingMethod != value)
                {
                    _FinancingMethod = value;
                    SendPropertyChanged("FinancingMethod");
                }
            }
        }
        #endregion

        #region AdditionalRemark
        [DataMember]
        string _AdditionalRemark = string.Empty;
        public string AdditionalRemark
        {
            get
            {
                return _AdditionalRemark;
            }
            set
            {
                if (_AdditionalRemark != value)
                {
                    _AdditionalRemark = value;
                    SendPropertyChanged("AdditionalRemark");
                }
            }
        }
        #endregion
        #endregion
    }

    [DataContract]
    public class Step_BalanceAndOthers_LIQUIDITYPLAN : INotifyPropertyChanged
    {
        public Step_BalanceAndOthers_LIQUIDITYPLAN()
        {
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_LIQUIDITYPLAN_Item>();
        }
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        public string CompanyName { get { return ProjectData.Intance.CompanyName; } }
        #region UI
        #region Step_BalanceAndOthers_LIQUIDITYPLAN_Header
        [DataMember]
        string _Step_BalanceAndOthers_LIQUIDITYPLAN_Header = string.Empty;
        public string Step_BalanceAndOthers_LIQUIDITYPLAN_Header
        {
            get
            {
                if (string.IsNullOrEmpty(_Step_BalanceAndOthers_LIQUIDITYPLAN_Header))
                {
                    _Step_BalanceAndOthers_LIQUIDITYPLAN_Header = "Liquidity Plan";
                }
                return _Step_BalanceAndOthers_LIQUIDITYPLAN_Header;
            }
            set
            {
                if (_Step_BalanceAndOthers_LIQUIDITYPLAN_Header != value)
                {
                    _Step_BalanceAndOthers_LIQUIDITYPLAN_Header = value;
                    SendPropertyChanged("Step_BalanceAndOthers_LIQUIDITYPLAN_Header");
                }
            }
        }
        #endregion

        #region UIText_RECEIPTINCOME
        [DataMember]
        string _UIText_RECEIPTINCOME = string.Empty;
        public string UIText_RECEIPTINCOME
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_RECEIPTINCOME))
                {
                    _UIText_RECEIPTINCOME = "RECEIPT INCOME:";
                }
                return _UIText_RECEIPTINCOME;
            }
            set
            {
                if (_UIText_RECEIPTINCOME != value)
                {
                    _UIText_RECEIPTINCOME = value;
                    SendPropertyChanged("UIText_RECEIPTINCOME");
                }
            }
        }
        #endregion

        #region UIText_Total_RECEIPTINCOME
        [DataMember]
        string _UIText_Total_RECEIPTINCOME = string.Empty;
        public string UIText_Total_RECEIPTINCOME
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total_RECEIPTINCOME))
                {
                    _UIText_Total_RECEIPTINCOME = "Total Receipt of income:";
                }
                return _UIText_Total_RECEIPTINCOME;
            }
            set
            {
                if (_UIText_Total_RECEIPTINCOME != value)
                {
                    _UIText_Total_RECEIPTINCOME = value;
                    SendPropertyChanged("UIText_Total_RECEIPTINCOME");
                }
            }
        }
        #endregion

        #region UIText_PAYMENTS
        [DataMember]
        string _UIText_PAYMENTS = string.Empty;
        public string UIText_PAYMENTS
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_PAYMENTS))
                {
                    _UIText_PAYMENTS = "PAYMENTS:";
                }
                return _UIText_PAYMENTS;
            }
            set
            {
                if (_UIText_PAYMENTS != value)
                {
                    _UIText_PAYMENTS = value;
                    SendPropertyChanged("UIText_PAYMENTS");
                }
            }
        }
        #endregion

        #region UIText_Total_PAYMENTS
        [DataMember]
        string _UIText_Total_PAYMENTS = string.Empty;
        public string UIText_Total_PAYMENTS
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total_PAYMENTS))
                {
                    _UIText_Total_PAYMENTS = "Total payments:";
                }
                return _UIText_Total_PAYMENTS;
            }
            set
            {
                if (_UIText_Total_PAYMENTS != value)
                {
                    _UIText_Total_PAYMENTS = value;
                    SendPropertyChanged("UIText_Total_PAYMENTS");
                }
            }
        }
        #endregion

        #region UIText_ADDITIONALINCOME
        [DataMember]
        string _UIText_ADDITIONALINCOME = string.Empty;
        public string UIText_ADDITIONALINCOME
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_ADDITIONALINCOME))
                {
                    _UIText_ADDITIONALINCOME = "ADDITIONAL INCOME:";
                }
                return _UIText_ADDITIONALINCOME;
            }
            set
            {
                if (_UIText_ADDITIONALINCOME != value)
                {
                    _UIText_ADDITIONALINCOME = value;
                    SendPropertyChanged("UIText_ADDITIONALINCOME");
                }
            }
        }
        #endregion

        #region UIText_Total_ADDITIONALINCOME
        [DataMember]
        string _UIText_Total_ADDITIONALINCOME = string.Empty;
        public string UIText_Total_ADDITIONALINCOME
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total_ADDITIONALINCOME))
                {
                    _UIText_Total_ADDITIONALINCOME = "Total addiontional income:";
                }
                return _UIText_Total_ADDITIONALINCOME;
            }
            set
            {
                if (_UIText_Total_ADDITIONALINCOME != value)
                {
                    _UIText_Total_ADDITIONALINCOME = value;
                    SendPropertyChanged("UIText_Total_ADDITIONALINCOME");
                }
            }
        }
        #endregion

        #region UIText_ADDITIONALPAYMENT
        [DataMember]
        string _UIText_ADDITIONALPAYMENT = string.Empty;
        public string UIText_ADDITIONALPAYMENT
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_ADDITIONALPAYMENT))
                {
                    _UIText_ADDITIONALPAYMENT = "ADDITIONAL PAYMENT:";
                }
                return _UIText_ADDITIONALPAYMENT;
            }
            set
            {
                if (_UIText_ADDITIONALPAYMENT != value)
                {
                    _UIText_ADDITIONALPAYMENT = value;
                    SendPropertyChanged("UIText_ADDITIONALPAYMENT");
                }
            }
        }
        #endregion

        #region UIText_Total_ADDITIONALPAYMENT
        [DataMember]
        string _UIText_Total_ADDITIONALPAYMENT = string.Empty;
        public string UIText_Total_ADDITIONALPAYMENT
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total_ADDITIONALPAYMENT))
                {
                    _UIText_Total_ADDITIONALPAYMENT = "Total additional payment:";
                }
                return _UIText_Total_ADDITIONALPAYMENT;
            }
            set
            {
                if (_UIText_Total_ADDITIONALPAYMENT != value)
                {
                    _UIText_Total_ADDITIONALPAYMENT = value;
                    SendPropertyChanged("UIText_Total_ADDITIONALPAYMENT");
                }
            }
        }
        #endregion

        #region UIText_Total_NETCASHFLOW
        [DataMember]
        string _UIText_Total_NETCASHFLOW = string.Empty;
        public string UIText_Total_NETCASHFLOW
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total_NETCASHFLOW))
                {
                    _UIText_Total_NETCASHFLOW = "NET CASH FLOW:";
                }
                return _UIText_Total_NETCASHFLOW;
            }
            set
            {
                if (_UIText_Total_NETCASHFLOW != value)
                {
                    _UIText_Total_NETCASHFLOW = value;
                    SendPropertyChanged("UIText_Total_NETCASHFLOW");
                }
            }
        }
        #endregion

        #region UIText_Total_GROSSCASHFLOW
        [DataMember]
        string _UIText_Total_GROSSCASHFLOW = string.Empty;
        public string UIText_Total_GROSSCASHFLOW
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total_GROSSCASHFLOW))
                {
                    _UIText_Total_GROSSCASHFLOW = "GROSS CASH FLOW:";
                }
                return _UIText_Total_GROSSCASHFLOW;
            }
            set
            {
                if (_UIText_Total_GROSSCASHFLOW != value)
                {
                    _UIText_Total_GROSSCASHFLOW = value;
                    SendPropertyChanged("UIText_Total_GROSSCASHFLOW");
                }
            }
        }
        #endregion

        #region UIText_STATUSBANKACCOUNT
        [DataMember]
        string _UIText_STATUSBANKACCOUNT = string.Empty;
        public string UIText_STATUSBANKACCOUNT
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_STATUSBANKACCOUNT))
                {
                    _UIText_STATUSBANKACCOUNT = "STATUS BANK ACCOUNT:";
                }
                return _UIText_STATUSBANKACCOUNT;
            }
            set
            {
                if (_UIText_STATUSBANKACCOUNT != value)
                {
                    _UIText_STATUSBANKACCOUNT = value;
                    SendPropertyChanged("UIText_STATUSBANKACCOUNT");
                }
            }
        }
        #endregion

        #region UIText_Total_STATUSBANKACCOUNT
        [DataMember]
        string _UIText_Total_STATUSBANKACCOUNT = string.Empty;
        public string UIText_Total_STATUSBANKACCOUNT
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total_STATUSBANKACCOUNT))
                {
                    _UIText_Total_STATUSBANKACCOUNT = "STATUS BANK ACCOUNT:";
                }
                return _UIText_Total_STATUSBANKACCOUNT;
            }
            set
            {
                if (_UIText_Total_STATUSBANKACCOUNT != value)
                {
                    _UIText_Total_STATUSBANKACCOUNT = value;
                    SendPropertyChanged("UIText_Total_STATUSBANKACCOUNT");
                }
            }
        }
        #endregion

        #region UIText_Total_CASHABUNDANCE
        [DataMember]
        string _UIText_Total_CASHABUNDANCE = string.Empty;
        public string UIText_Total_CASHABUNDANCE
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Total_CASHABUNDANCE))
                {
                    _UIText_Total_CASHABUNDANCE = "CASH ABUNDANCE (Positive)/need for cash (negative):";
                }
                return _UIText_Total_CASHABUNDANCE;
            }
            set
            {
                if (_UIText_Total_CASHABUNDANCE != value)
                {
                    _UIText_Total_CASHABUNDANCE = value;
                    SendPropertyChanged("UIText_Total_CASHABUNDANCE");
                }
            }
        }
        #endregion

        #region UIText_Value
        [DataMember]
        string _UIText_Value = string.Empty;
        public string UIText_Value
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Value))
                {
                    _UIText_Value = "Value";
                }
                return _UIText_Value;
            }
            set
            {
                if (_UIText_Value != value)
                {
                    _UIText_Value = value;
                    SendPropertyChanged("UIText_Value");
                }
            }
        }
        #endregion

        #region UIText_Year1
        [DataMember]
        string _UIText_Year1 = string.Empty;
        public string UIText_Year1
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year1))
                {
                    _UIText_Year1 = "Year 1";
                }
                return _UIText_Year1;
            }
            set
            {
                if (_UIText_Year1 != value)
                {
                    _UIText_Year1 = value;
                    SendPropertyChanged("UIText_Year1");
                }
            }
        }
        #endregion

        #region UIText_Year2
        [DataMember]
        string _UIText_Year2 = string.Empty;
        public string UIText_Year2
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year2))
                {
                    _UIText_Year2 = "Year 2";
                }
                return _UIText_Year2;
            }
            set
            {
                if (_UIText_Year2 != value)
                {
                    _UIText_Year2 = value;
                    SendPropertyChanged("UIText_Year2");
                }
            }
        }
        #endregion

        #region UIText_Year3
        [DataMember]
        string _UIText_Year3 = string.Empty;
        public string UIText_Year3
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year3))
                {
                    _UIText_Year3 = "Year 3";
                }
                return _UIText_Year3;
            }
            set
            {
                if (_UIText_Year3 != value)
                {
                    _UIText_Year3 = value;
                    SendPropertyChanged("UIText_Year3");
                }
            }
        }
        #endregion

        #region UIText_Year4
        [DataMember]
        string _UIText_Year4 = string.Empty;
        public string UIText_Year4
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year4))
                {
                    _UIText_Year4 = "Year 4";
                }
                return _UIText_Year4;
            }
            set
            {
                if (_UIText_Year4 != value)
                {
                    _UIText_Year4 = value;
                    SendPropertyChanged("UIText_Year4");
                }
            }
        }
        #endregion

        #region UIText_Year5
        [DataMember]
        string _UIText_Year5 = string.Empty;
        public string UIText_Year5
        {
            get
            {
                if (string.IsNullOrEmpty(_UIText_Year5))
                {
                    _UIText_Year5 = "Year 5";
                }
                return _UIText_Year5;
            }
            set
            {
                if (_UIText_Year5 != value)
                {
                    _UIText_Year5 = value;
                    SendPropertyChanged("UIText_Year5");
                }
            }
        }
        #endregion
        #endregion

        #region Data
        public void RefreshData()
        {
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_LIQUIDITYPLAN_Item>();
            var _items = Items;
            foreach (var item in _items)
            {
                if (item != null)
                {
                    if (item.Parent != this)
                        item.Parent = this;
                }
            }
        }
        [DataMember]
        public List<Step_BalanceAndOthers_LIQUIDITYPLAN_Item> Items { get; set; }
        public Step_BalanceAndOthers_LIQUIDITYPLAN_Item[] Items_RECEIPTINCOME
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_LIQUIDITYPLAN_Item[0] : Items.Where(c => c.GroupName == GROUP_RECEIPTINCOME).ToArray();
            }
            set { }
        }
        public Step_BalanceAndOthers_LIQUIDITYPLAN_Item[] Items_PAYMENTS
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_LIQUIDITYPLAN_Item[0] : Items.Where(c => c.GroupName == GROUP_PAYMENTS).ToArray();
            }
            set { }
        }
        public Step_BalanceAndOthers_LIQUIDITYPLAN_Item[] Items_ADDITIONALINCOME
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_LIQUIDITYPLAN_Item[0] : Items.Where(c => c.GroupName == GROUP_ADDITIONALINCOME).ToArray();
            }
            set { }
        }
        public Step_BalanceAndOthers_LIQUIDITYPLAN_Item[] Items_ADDITIONALPAYMENT
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_LIQUIDITYPLAN_Item[0] : Items.Where(c => c.GroupName == GROUP_ADDITIONALPAYMENT).ToArray();
            }
            set { }
        }
        public Step_BalanceAndOthers_LIQUIDITYPLAN_Item[] Items_STATUSBANKACCOUNT
        {
            get
            {
                return Items == null ? new Step_BalanceAndOthers_LIQUIDITYPLAN_Item[0] : Items.Where(c => c.GroupName == GROUP_STATUSBANKACCOUNT).ToArray();
            }
            set { }
        }

        #region GROUP_RECEIPTINCOME_Total
        public double GROUP_RECEIPTINCOME_Total_Year1
        {
            get { return Items_RECEIPTINCOME.Sum(c => c.Year1); }
        }
        public double GROUP_RECEIPTINCOME_Total_Year2
        {
            get { return Items_RECEIPTINCOME.Sum(c => c.Year2); }
        }
        public double GROUP_RECEIPTINCOME_Total_Year3
        {
            get { return Items_RECEIPTINCOME.Sum(c => c.Year3); }
        }
        public double GROUP_RECEIPTINCOME_Total_Year4
        {
            get { return Items_RECEIPTINCOME.Sum(c => c.Year4); }
        }
        public double GROUP_RECEIPTINCOME_Total_Year5
        {
            get { return Items_RECEIPTINCOME.Sum(c => c.Year5); }
        }
        #endregion

        #region GROUP_PAYMENTS_Total
        public double GROUP_PAYMENTS_Total_Year1
        {
            get { return Items_PAYMENTS.Sum(c => c.Year1); }
        }
        public double GROUP_PAYMENTS_Total_Year2
        {
            get { return Items_PAYMENTS.Sum(c => c.Year2); }
        }
        public double GROUP_PAYMENTS_Total_Year3
        {
            get { return Items_PAYMENTS.Sum(c => c.Year3); }
        }
        public double GROUP_PAYMENTS_Total_Year4
        {
            get { return Items_PAYMENTS.Sum(c => c.Year4); }
        }
        public double GROUP_PAYMENTS_Total_Year5
        {
            get { return Items_PAYMENTS.Sum(c => c.Year5); }
        }
        #endregion

        #region GROUP_ADDITIONALINCOME_Total
        public double GROUP_ADDITIONALINCOME_Total_Year1
        {
            get { return Items_ADDITIONALINCOME.Sum(c => c.Year1); }
        }
        public double GROUP_ADDITIONALINCOME_Total_Year2
        {
            get { return Items_ADDITIONALINCOME.Sum(c => c.Year2); }
        }
        public double GROUP_ADDITIONALINCOME_Total_Year3
        {
            get { return Items_ADDITIONALINCOME.Sum(c => c.Year3); }
        }
        public double GROUP_ADDITIONALINCOME_Total_Year4
        {
            get { return Items_ADDITIONALINCOME.Sum(c => c.Year4); }
        }
        public double GROUP_ADDITIONALINCOME_Total_Year5
        {
            get { return Items_ADDITIONALINCOME.Sum(c => c.Year5); }
        }
        #endregion

        #region GROUP_ADDITIONALPAYMENT_Total
        public double GROUP_ADDITIONALPAYMENT_Total_Year1
        {
            get { return Items_ADDITIONALPAYMENT.Sum(c => c.Year1); }
        }
        public double GROUP_ADDITIONALPAYMENT_Total_Year2
        {
            get { return Items_ADDITIONALPAYMENT.Sum(c => c.Year2); }
        }
        public double GROUP_ADDITIONALPAYMENT_Total_Year3
        {
            get { return Items_ADDITIONALPAYMENT.Sum(c => c.Year3); }
        }
        public double GROUP_ADDITIONALPAYMENT_Total_Year4
        {
            get { return Items_ADDITIONALPAYMENT.Sum(c => c.Year4); }
        }
        public double GROUP_ADDITIONALPAYMENT_Total_Year5
        {
            get { return Items_ADDITIONALPAYMENT.Sum(c => c.Year5); }
        }
        #endregion

        #region GROSS CASH FLOW
        public double GROUP_GROSSCASHFLOW_Total_Year1
        {
            get { return GROUP_RECEIPTINCOME_Total_Year1 - GROUP_PAYMENTS_Total_Year1; }
        }
        public double GROUP_GROSSCASHFLOW_Total_Year2
        {
            get { return GROUP_RECEIPTINCOME_Total_Year2 - GROUP_PAYMENTS_Total_Year2; }
        }
        public double GROUP_GROSSCASHFLOW_Total_Year3
        {
            get { return GROUP_RECEIPTINCOME_Total_Year3 - GROUP_PAYMENTS_Total_Year3; }
        }
        public double GROUP_GROSSCASHFLOW_Total_Year4
        {
            get { return GROUP_RECEIPTINCOME_Total_Year4 - GROUP_PAYMENTS_Total_Year4; }
        }
        public double GROUP_GROSSCASHFLOW_Total_Year5
        {
            get { return GROUP_RECEIPTINCOME_Total_Year5 - GROUP_PAYMENTS_Total_Year5; }
        }
        #endregion

        #region NET CASH FLOW
        public double GROUP_NETCASHFLOW_Total_Year1
        {
            get { return GROUP_GROSSCASHFLOW_Total_Year1 + GROUP_ADDITIONALINCOME_Total_Year1 - GROUP_ADDITIONALPAYMENT_Total_Year1; }
        }
        public double GROUP_NETCASHFLOW_Total_Year2
        {
            get { return GROUP_GROSSCASHFLOW_Total_Year2 + GROUP_ADDITIONALINCOME_Total_Year2 - GROUP_ADDITIONALPAYMENT_Total_Year2; }
        }
        public double GROUP_NETCASHFLOW_Total_Year3
        {
            get { return GROUP_GROSSCASHFLOW_Total_Year3 + GROUP_ADDITIONALINCOME_Total_Year3 - GROUP_ADDITIONALPAYMENT_Total_Year3; }
        }
        public double GROUP_NETCASHFLOW_Total_Year4
        {
            get { return GROUP_GROSSCASHFLOW_Total_Year4 + GROUP_ADDITIONALINCOME_Total_Year4 - GROUP_ADDITIONALPAYMENT_Total_Year4; }
        }
        public double GROUP_NETCASHFLOW_Total_Year5
        {
            get { return GROUP_GROSSCASHFLOW_Total_Year5 + GROUP_ADDITIONALINCOME_Total_Year5 - GROUP_ADDITIONALPAYMENT_Total_Year5; }
        }
        #endregion

        #region GROUP_STATUSBANKACCOUNT_Total
        public double GROUP_STATUSBANKACCOUNT_Total_Year1
        {
            get { return Items_STATUSBANKACCOUNT.Sum(c => c.Year1); }
        }
        public double GROUP_STATUSBANKACCOUNT_Total_Year2
        {
            get
            {
                //return GROUP_CASHABUNDANCE_Total_Year1;
                return Items_STATUSBANKACCOUNT.Sum(c => c.Year2);
            }
        }
        public double GROUP_STATUSBANKACCOUNT_Total_Year3
        {
            get
            {
                //return GROUP_CASHABUNDANCE_Total_Year2; 
                return Items_STATUSBANKACCOUNT.Sum(c => c.Year3);
            }
        }
        public double GROUP_STATUSBANKACCOUNT_Total_Year4
        {
            get
            {
                //return GROUP_CASHABUNDANCE_Total_Year3; 
                return Items_STATUSBANKACCOUNT.Sum(c => c.Year4);
            }
        }
        public double GROUP_STATUSBANKACCOUNT_Total_Year5
        {
            get
            {
                //return GROUP_CASHABUNDANCE_Total_Year4; 
                return Items_STATUSBANKACCOUNT.Sum(c => c.Year5);
            }
        }
        #endregion


        #region CASH ABUNDANCE
        public double GROUP_CASHABUNDANCE_Total_Year1
        {
            get
            {
                var value = GROUP_STATUSBANKACCOUNT_Total_Year1 + GROUP_NETCASHFLOW_Total_Year1;
                if (Items_STATUSBANKACCOUNT.Length > 0)
                {
                    Items_STATUSBANKACCOUNT[0].Year2 = value;
                }
                return value;
            }
        }
        public double GROUP_CASHABUNDANCE_Total_Year2
        {
            get
            {
                var value = GROUP_STATUSBANKACCOUNT_Total_Year2 + GROUP_NETCASHFLOW_Total_Year2;
                if (Items_STATUSBANKACCOUNT.Length > 0)
                {
                    Items_STATUSBANKACCOUNT[0].Year3 = value;
                }
                return value;
            }
        }
        public double GROUP_CASHABUNDANCE_Total_Year3
        {
            get
            {
                var value = GROUP_STATUSBANKACCOUNT_Total_Year3 + GROUP_NETCASHFLOW_Total_Year3;
                if (Items_STATUSBANKACCOUNT.Length > 0)
                {
                    Items_STATUSBANKACCOUNT[0].Year4 = value;
                }
                return value;
            }
        }
        public double GROUP_CASHABUNDANCE_Total_Year4
        {
            get
            {
                var value = GROUP_STATUSBANKACCOUNT_Total_Year4 + GROUP_NETCASHFLOW_Total_Year4;
                if (Items_STATUSBANKACCOUNT.Length > 0)
                {
                    Items_STATUSBANKACCOUNT[0].Year5 = value;
                }
                return value;
            }
        }
        public double GROUP_CASHABUNDANCE_Total_Year5
        {
            get { return GROUP_STATUSBANKACCOUNT_Total_Year5 + GROUP_NETCASHFLOW_Total_Year5; }
        }
        #endregion
        public string GROUP_RECEIPTINCOME
        {
            get { return "RECEIPTINCOME"; }
        }
        public string GROUP_PAYMENTS
        {
            get { return "PAYMENTS"; }
        }
        public string GROUP_ADDITIONALINCOME
        {
            get { return "ADDITIONALINCOME"; }
        }
        public string GROUP_ADDITIONALPAYMENT
        {
            get { return "ADDITIONALPAYMENT"; }
        }
        public string GROUP_STATUSBANKACCOUNT
        {
            get { return "STATUSBANKACCOUNT"; }
        }

        public void SendPropertyChanged_Total()
        {
            SendPropertyChanged("GROUP_RECEIPTINCOME_Total_Year1");
            SendPropertyChanged("GROUP_RECEIPTINCOME_Total_Year2");
            SendPropertyChanged("GROUP_RECEIPTINCOME_Total_Year3");
            SendPropertyChanged("GROUP_RECEIPTINCOME_Total_Year4");
            SendPropertyChanged("GROUP_RECEIPTINCOME_Total_Year5");

            SendPropertyChanged("GROUP_PAYMENTS_Total_Year1");
            SendPropertyChanged("GROUP_PAYMENTS_Total_Year2");
            SendPropertyChanged("GROUP_PAYMENTS_Total_Year3");
            SendPropertyChanged("GROUP_PAYMENTS_Total_Year4");
            SendPropertyChanged("GROUP_PAYMENTS_Total_Year5");

            SendPropertyChanged("GROUP_ADDITIONALINCOME_Total_Year1");
            SendPropertyChanged("GROUP_ADDITIONALINCOME_Total_Year2");
            SendPropertyChanged("GROUP_ADDITIONALINCOME_Total_Year3");
            SendPropertyChanged("GROUP_ADDITIONALINCOME_Total_Year4");
            SendPropertyChanged("GROUP_ADDITIONALINCOME_Total_Year5");

            SendPropertyChanged("GROUP_ADDITIONALPAYMENT_Total_Year1");
            SendPropertyChanged("GROUP_ADDITIONALPAYMENT_Total_Year2");
            SendPropertyChanged("GROUP_ADDITIONALPAYMENT_Total_Year3");
            SendPropertyChanged("GROUP_ADDITIONALPAYMENT_Total_Year4");
            SendPropertyChanged("GROUP_ADDITIONALPAYMENT_Total_Year5");

            SendPropertyChanged("GROUP_GROSSCASHFLOW_Total_Year1");
            SendPropertyChanged("GROUP_GROSSCASHFLOW_Total_Year2");
            SendPropertyChanged("GROUP_GROSSCASHFLOW_Total_Year3");
            SendPropertyChanged("GROUP_GROSSCASHFLOW_Total_Year4");
            SendPropertyChanged("GROUP_GROSSCASHFLOW_Total_Year5");

            SendPropertyChanged("GROUP_NETCASHFLOW_Total_Year1");
            SendPropertyChanged("GROUP_NETCASHFLOW_Total_Year2");
            SendPropertyChanged("GROUP_NETCASHFLOW_Total_Year3");
            SendPropertyChanged("GROUP_NETCASHFLOW_Total_Year4");
            SendPropertyChanged("GROUP_NETCASHFLOW_Total_Year5");

            SendPropertyChanged("GROUP_CASHABUNDANCE_Total_Year1");
            SendPropertyChanged("GROUP_CASHABUNDANCE_Total_Year2");
            SendPropertyChanged("GROUP_CASHABUNDANCE_Total_Year3");
            SendPropertyChanged("GROUP_CASHABUNDANCE_Total_Year4");
            SendPropertyChanged("GROUP_CASHABUNDANCE_Total_Year5");
        }
        #region CurrencySymbol
        [DataMember]
        string _CurrencySymbol = string.Empty;
        public string CurrencySymbol
        {
            get { return _CurrencySymbol; }
            set
            {
                if (_CurrencySymbol != value)
                {
                    _CurrencySymbol = value;
                    SendPropertyChanged("CurrencySymbol");
                }
            }
        }
        #endregion

        #region CurrencySymbol_UI
        [DataMember]
        string _CurrencySymbol_UI = "Currency Symbol";
        public string CurrencySymbol_UI
        {
            get { return _CurrencySymbol_UI; }
            set
            {
                if (_CurrencySymbol_UI != value)
                {
                    _CurrencySymbol_UI = value;
                    SendPropertyChanged("CurrencySymbol_UI");
                }
            }
        }
        #endregion
        #endregion

        #region Add
        public void AddNew(string group)
        {
            Step_BalanceAndOthers_LIQUIDITYPLAN_Item newItem = new Step_BalanceAndOthers_LIQUIDITYPLAN_Item(this)
            {
                GroupName = group,
            };
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_LIQUIDITYPLAN_Item>();
            Items.Add(newItem);
        }
        public void AddNew(string group, string name)
        {
            Step_BalanceAndOthers_LIQUIDITYPLAN_Item newItem = new Step_BalanceAndOthers_LIQUIDITYPLAN_Item(this)
            {
                GroupName = group,
                Name = name
            };
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_LIQUIDITYPLAN_Item>();
            Items.Add(newItem);
        }
        public void AddNew(string group, bool just1InGrp)
        {
            Step_BalanceAndOthers_LIQUIDITYPLAN_Item newItem = new Step_BalanceAndOthers_LIQUIDITYPLAN_Item(this)
            {
                GroupName = group,
                Name = just1InGrp == true ? group : string.Empty
            };
            if (Items == null)
                Items = new List<Step_BalanceAndOthers_LIQUIDITYPLAN_Item>();
            Items.Add(newItem);
        }
        public void Remove(Step_BalanceAndOthers_LIQUIDITYPLAN_Item removeItem)
        {
            var grps = this.Items.Where(c => c.GroupName == removeItem.GroupName);
            if (grps.Count() == 1)
            {
                removeItem.Name = string.Empty;
                removeItem.Year1 = 0;
                removeItem.Year2 = 0;
                removeItem.Year3 = 0;
                removeItem.Year4 = 0;
                removeItem.Year5 = 0;

            }
            else
            {
                this.Items.Remove(removeItem);
            }
        }
        #endregion
    }
    [DataContract]
    public class Step_BalanceAndOthers_LIQUIDITYPLAN_Item : INotifyPropertyChanged
    {
        Step_BalanceAndOthers_LIQUIDITYPLAN _Parent;
        public Step_BalanceAndOthers_LIQUIDITYPLAN Parent
        {
            get { return _Parent; }
            set
            {
                if (value != _Parent)
                {
                    _Parent = value;
                    this.PropertyChanged -= new PropertyChangedEventHandler(Step_BalanceAndOthers_LIQUIDITYPLAN_Item_PropertyChanged);
                    this.PropertyChanged += new PropertyChangedEventHandler(Step_BalanceAndOthers_LIQUIDITYPLAN_Item_PropertyChanged);
                }
            }
        }
        public Step_BalanceAndOthers_LIQUIDITYPLAN_Item(Step_BalanceAndOthers_LIQUIDITYPLAN parent)
        {
            Parent = parent;
        }

        void Step_BalanceAndOthers_LIQUIDITYPLAN_Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (Parent != null)
                Parent.SendPropertyChanged_Total();
        }

        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region Data
        #region GroupName
        [DataMember]
        string _GroupName = string.Empty;
        public string GroupName
        {
            get
            {
                return _GroupName;
            }
            set
            {
                if (_GroupName != value)
                {
                    _GroupName = value;
                    SendPropertyChanged("GroupName");
                }
            }
        }
        #endregion

        #region Name
        [DataMember]
        string _Name = string.Empty;
        public string Name
        {
            get
            {
                return _Name;
            }
            set
            {
                if (_Name != value)
                {
                    _Name = value;
                    SendPropertyChanged("Name");
                }
            }
        }
        #endregion

        #region Year1
        [DataMember]
        double _Year1 = 0;
        public double Year1
        {
            get
            {
                return _Year1;
            }
            set
            {
                if (_Year1 != value)
                {
                    _Year1 = value;
                    SendPropertyChanged("Year1");
                }
            }
        }
        #endregion

        #region Year2
        [DataMember]
        double _Year2 = 0;
        public double Year2
        {
            get
            {
                return _Year2;
            }
            set
            {
                if (_Year2 != value)
                {
                    _Year2 = value;
                    SendPropertyChanged("Year2");
                }
            }
        }
        #endregion

        #region Year3
        [DataMember]
        double _Year3 = 0;
        public double Year3
        {
            get
            {
                return _Year3;
            }
            set
            {
                if (_Year3 != value)
                {
                    _Year3 = value;
                    SendPropertyChanged("Year3");
                }
            }
        }
        #endregion

        #region Year4
        [DataMember]
        double _Year4 = 0;
        public double Year4
        {
            get
            {
                return _Year4;
            }
            set
            {
                if (_Year4 != value)
                {
                    _Year4 = value;
                    SendPropertyChanged("Year4");
                }
            }
        }
        #endregion

        #region Year5
        [DataMember]
        double _Year5 = 0;
        public double Year5
        {
            get
            {
                return _Year5;
            }
            set
            {
                if (_Year5 != value)
                {
                    _Year5 = value;
                    SendPropertyChanged("Year5");
                }
            }
        }
        #endregion
        #endregion
    }

    #endregion
    [DataContract]
    public class Step_Measurement : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        public Step_Measurement(Step_Measurement_Item[] aMeasurements)
        {
            Measurements = aMeasurements;
        }

        [DataMember]
        private Step_Measurement_Item[] Measurements
        {
            get
            {
                if (Measurements_Source == null)
                    return null;
                return Measurements_Source.ToArray();
            }
            set
            {
                if (value != null)
                    Measurements_Source = new ObservableCollection<Step_Measurement_Item>(value);
                else
                    Measurements_Source = new ObservableCollection<Step_Measurement_Item>();
                SendPropertyChanged("TaskItemGroups");
                SendPropertyChanged("TaskItemGroups_Source");
            }
        }
        #region Measurements_Source
        private ObservableCollection<Step_Measurement_Item> _Measurements_Source;        
        public ObservableCollection<Step_Measurement_Item> Measurements_Source
        {
            get
            { 
                return _Measurements_Source; 
            }
            private set 
            { 
                _Measurements_Source = value;
                SendPropertyChanged("Measurements_Source");
            }
        }
        public void Measurements_Source_SortBy_Name()
        {
            if (Measurements_Source != null)
                Measurements_Source = new ObservableCollection<Step_Measurement_Item> (Measurements_Source.OrderBy(c => c.Name));
        }
        public void Measurements_Source_SortBy_StartDate()
        {
            if (Measurements_Source != null)
                Measurements_Source = new ObservableCollection<Step_Measurement_Item>(Measurements_Source.OrderBy(c => c.StartedDate));
        }
        public void Measurements_Source_SortBy_Duration()
        {
            if (Measurements_Source != null)
                Measurements_Source = new ObservableCollection<Step_Measurement_Item>(Measurements_Source.OrderBy(c => c.Duration));
        }
        public void Measurements_Source_SortBy_DaysRemaining()
        {
            if (Measurements_Source != null)
                Measurements_Source = new ObservableCollection<Step_Measurement_Item>(Measurements_Source.OrderBy(c => c.DaysRemaining));
        }
        #endregion
    }
    [DataContract]
    public class Step_Measurement_Item : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region Name
        [DataMember]
        string _Name = string.Empty;
        public string Name
        {
            get { return _Name; }
            set
            {
                if (_Name != value)
                {
                    _Name = value;
                    SendPropertyChanged("Name");
                }
            }
        }
        #endregion

        #region ResponsiblePerson
        [DataMember]
        string _ResponsiblePerson = string.Empty;
        public string ResponsiblePerson
        {
            get { return _ResponsiblePerson; }
            set
            {
                if (_ResponsiblePerson != value)
                {
                    _ResponsiblePerson = value;
                    SendPropertyChanged("ResponsiblePerson");
                }
            }
        }
        #endregion

        #region StartedDate
        [DataMember]
        DateTime _StartedDate = DateTime.Now;
        public DateTime StartedDate
        {
            get { return _StartedDate; }
            set
            {
                if (_StartedDate != value)
                {
                    _StartedDate = value;
                    SendPropertyChanged("StartedDate");
                    SendPropertyChanged("IM_StartedDate");
                    SendPropertyChanged("EndDate");
                    SendPropertyChanged("IM_EndDate");
                    SendPropertyChanged("DaysRemaining");
                }
            }
        }
        public string IM_StartedDate
        {
            get
            {
                return string.Format("{0:dd/MM/yyyy}", StartedDate); 
            }
        }
        #endregion

        #region Duration
        [DataMember]
        int _Duration = 0;
        public int Duration
        {
            get { return _Duration; }
            set
            {
                if (_Duration != value)
                {
                    _Duration = value;
                    SendPropertyChanged("Duration");
                    SendPropertyChanged("EndDate");
                    SendPropertyChanged("IM_EndDate");
                    SendPropertyChanged("DaysRemaining");
                }
            }
        }
        #endregion

        #region EndDate
        public DateTime EndDate
        {
            get
            {
                return StartedDate.AddMonths(Duration);
            }
        }
        public string IM_EndDate
        {
            get
            {
                return string.Format("{0:dd/MM/yyyy}", EndDate);
            }
        }
        #endregion

        #region DaysRemaining
        public int DaysRemaining
        {
            get
            {
                 var temp = EndDate - DateTime.Today;
                 return temp.Days;
            }
           
        }
        #endregion

        #region Status
        [DataMember]
        string _Status = string.Empty;
        public string Status
        {
            get { return _Status; }
            set
            {
                if (_Status != value)
                {
                    _Status = value;
                    SendPropertyChanged("Status");
                }
            }
        }
        #endregion

        #region Goal
        [DataMember]
        string _Goal = string.Empty;
        public string Goal
        {
            get { return _Goal; }
            set
            {
                if (_Goal != value)
                {
                    _Goal = value;
                    SendPropertyChanged("Goal");
                }
            }
        }
        #endregion

        #region Procedure
        [DataMember]
        string _Procedure = string.Empty;
        public string Procedure
        {
            get { return _Procedure; }
            set
            {
                if (_Procedure != value)
                {
                    _Procedure = value;
                    SendPropertyChanged("Procedure");
                }
            }
        }
        #endregion

        #region Expenses
        [DataMember]
        string _Expenses = string.Empty;
        public string Expenses
        {
            get { return _Expenses; }
            set
            {
                if (_Expenses != value)
                {
                    _Expenses = value;
                    SendPropertyChanged("Expenses");
                }
            }
        }
        #endregion

        #region ExpectedBenefits
        [DataMember]
        string _ExpectedBenefits = string.Empty;
        public string ExpectedBenefits
        {
            get { return _ExpectedBenefits; }
            set
            {
                if (_ExpectedBenefits != value)
                {
                    _ExpectedBenefits = value;
                    SendPropertyChanged("ExpectedBenefits");
                }
            }
        }
        #endregion
    }

    [DataContract]
    public class Step_Analysis
    {
        [DataMember]
        public string Analysis1 { get; set; }
        [DataMember]
        public string Interpretation1 { get; set; }
        [DataMember]
        public string Analysis2 { get; set; }
        [DataMember]
        public string Interpretation2 { get; set; }
        [DataMember]
        public string Analysis3 { get; set; }
        [DataMember]
        public string Interpretation3 { get; set; }
    }
    [DataContract]
    public class Step_QuestionAnwserStep : INotifyPropertyChanged
    {
        public Step_QuestionAnwserStep(Step_QuestionAnwserGroup[] qas)
        {
            QuestionAnwserGroups_Source = new ObservableCollection<Step_QuestionAnwserGroup>(qas);
        }
        [DataMember]
        private Step_QuestionAnwserGroup[] QuestionAnwserGroups
        {
            get
            {
                if (QuestionAnwserGroups_Source == null)
                    return null;
                return QuestionAnwserGroups_Source.ToArray();
            }
            set
            {
                QuestionAnwserGroups_Source = new ObservableCollection<Step_QuestionAnwserGroup>(value);
                SendPropertyChanged("QuestionAnwserGroups");
                SendPropertyChanged("QuestionAnwserGroups_Source");
            }
        }
        public ObservableCollection<Step_QuestionAnwserGroup> QuestionAnwserGroups_Source
        {
            get;
            private set;
        }

        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
    [DataContract]
    public class Step_QuestionAnwserGroup : INotifyPropertyChanged
    {
        public Step_QuestionAnwserGroup(Step_QuestionAnwser[] data)
        {
            QuestionAnswers_Source = new ObservableCollection<Step_QuestionAnwser>(data);
        }
        [DataMember]
        public string Name { get; set; }


        #region QuestionAnswers
        [DataMember]
        private Step_QuestionAnwser[] QuestionAnswers
        {
            get
            {
                if (QuestionAnswers_Source == null)
                    return null;
                return QuestionAnswers_Source.ToArray();
            }
            set
            {
                QuestionAnswers_Source = new ObservableCollection<Step_QuestionAnwser>(value);
                SendPropertyChanged("QuestionAnswers");
                SendPropertyChanged("QuestionAnswers_Source");
            }
        }
        public ObservableCollection<Step_QuestionAnwser> QuestionAnswers_Source
        {
            get;
            private set;
        }
        #endregion
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
    [DataContract]
    public class Step_QuestionAnwser
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
        #region Question
        string _Question = string.Empty;
        [DataMember]
        public string Question
        {
            get { return _Question; }
            set
            {
                if (_Question != value)
                {
                    _Question = value;
                    SendPropertyChanged("Question");
                }
            }
        }
        #endregion

        #region Answer
        string _Answer = string.Empty;
        [DataMember]
        public string Answer
        {
            get { return _Answer; }
            set
            {
                if (_Answer != value)
                {
                    _Answer = value;
                    SendPropertyChanged("Answer");
                }
            }
        }
        #endregion

    }



    [DataContract]
    public class Step_TaskItemStep : INotifyPropertyChanged
    {
        public Step_TaskItemStep(Step_TaskItemGroup[] tasks)
        {
            TaskItemGroups_Source = new ObservableCollection<Step_TaskItemGroup>(tasks);
            Setup_Listening_4Tasks_Summary();
        }

        [DataMember]
        private Step_TaskItemGroup[] TaskItemGroups
        {
            get
            {
                if (TaskItemGroups_Source == null)
                    return null;
                return TaskItemGroups_Source.ToArray();
            }
            set
            {
                TaskItemGroups_Source = new ObservableCollection<Step_TaskItemGroup>(value);
                Setup_Listening_4Tasks_Summary();
                SendPropertyChanged("TaskItemGroups");
                SendPropertyChanged("TaskItemGroups_Source");
            }
        }
        public ObservableCollection<Step_TaskItemGroup> TaskItemGroups_Source
        {
            get;
            private set;
        }

        #region Tasks_Summary
        private void Setup_Listening_4Tasks_Summary()
        {
            TaskItemGroups_Source.CollectionChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(TaskItemGroups_Source_CollectionChanged);
            TaskItemGroups_Source.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(TaskItemGroups_Source_CollectionChanged);

            foreach (var taskItems in TaskItemGroups_Source)
            {
                taskItems.Tasks_Source.CollectionChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Tasks_Source_CollectionChanged);
                taskItems.Tasks_Source.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Tasks_Source_CollectionChanged);
            }
        }

        void Tasks_Source_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            Tasks_Summary_Raise();
        }

        void TaskItemGroups_Source_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            Tasks_Summary_Raise();
        }
        public Step_TaskItem[] Tasks_Summary
        {
            get
            {
                List<Step_TaskItem> list = new List<Step_TaskItem>();
                var groups = TaskItemGroups;
                if (groups != null && groups.Length > 0)
                {
                    foreach (var grp in groups)
                    {
                        list.AddRange(grp.Tasks_Source.ToArray());
                    }
                }
                return list.ToArray();
            }
        }
        public void Tasks_Summary_Raise()
        {
            SendPropertyChanged("Tasks_Summary");
        }
        #endregion

        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
    [DataContract]
    public class Step_TaskItemGroup : INotifyPropertyChanged
    {
        public Step_TaskItemGroup(Step_TaskItem[] tasks)
        {
            Tasks = tasks;
        }
        public Step_TaskItemGroup()
        {
            if (Tasks == null)
                Tasks = new Step_TaskItem[0];
        }
        #region Name
        [DataMember]
        string _Name = string.Empty;
        public string Name
        {
            get { return _Name; }
            set
            {
                if (_Name != value)
                {
                    _Name = value;
                    SendPropertyChanged("Name");
                }
            }
        }
        #endregion
        #region Code
        [DataMember]
        string _Code = string.Empty;
        public string Code
        {
            get { return _Code; }
            set
            {
                if (_Code != value)
                {
                    _Code = value;
                    SendPropertyChanged("Code");
                }
            }
        }
        #endregion

        public FactorType FactorType
        {
            get
            {
                if (Code.Contains("H"))
                    return FactorType.HK;
                if (Code.Contains("S"))
                    return FactorType.SK;
                return FactorType.BK;
            }
        }

        [DataMember]
        private Step_TaskItem[] Tasks
        {
            get
            {
                if (Tasks_Source == null)
                    return null;
                return Tasks_Source.ToArray();
            }
            set
            {
                Tasks_Source = new ObservableCollection<Step_TaskItem>(value);
            }
        }
        public ObservableCollection<Step_TaskItem> Tasks_Source
        {
            get;
            set;
        }



        #region IM_Current_Task
        Step_TaskItem _IM_Current_Task;
        public Step_TaskItem IM_Current_Task
        {
            get { return _IM_Current_Task; }
            set
            {
                if (_IM_Current_Task != value)
                {
                    _IM_Current_Task = value;
                    SendPropertyChanged("IM_Current_Task");
                }
            }
        }
        public bool IsEnableChangeInfo
        {
            get 
            { return IM_Current_Task != null;                 
            }
        }
        #endregion

        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }

    [DataContract]
    public class Step_TaskItem : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        public void SendPropertyChanged(string sProp)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(sProp));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
        #region ID
        private string _ID = string.Empty;
        /// <summary>
        /// Mức do quan trong
        /// </summary>
        [DataMember]
        public string ID
        {
            get { return _ID; }
            set
            {
                if (_ID != value)
                {
                    _ID = value;
                    SendPropertyChanged("ID");
                }
            }
        }
        #endregion

        #region Name
        private string _Name = string.Empty;
        /// <summary>
        /// Mức do quan trong
        /// </summary>
        [DataMember]
        public string Name
        {
            get { return _Name; }
            set
            {
                if (_Name != value)
                {
                    _Name = value;
                    SendPropertyChanged("Name");
                }
            }
        }
        #endregion

        #region Active
        private bool _Active = true;
        /// <summary>
        /// Mức do quan trong
        /// </summary>
        [DataMember]
        public bool Active
        {
            get { return _Active; }
            set
            {
                if (_Active != value)
                {
                    _Active = value;
                    SendPropertyChanged("Active");
                }
            }
        }
        #endregion

        #region Define
        private string _Define = string.Empty;
        /// <summary>
        /// Mức do quan trong
        /// </summary>
        [DataMember]
        public string Define
        {
            get { return _Define; }
            set
            {
                if (_Define != value)
                {
                    _Define = value;
                    SendPropertyChanged("Define");
                }
            }
        }
        #endregion

        #region Weight
        private int _Weight = 0;
        /// <summary>
        /// Mức do quan trong
        /// </summary>
        [DataMember]
        public int Weight
        {
            get { return _Weight; }
            set
            {
                if (_Weight != value)
                {
                    _Weight = value;
                    SendPropertyChanged("Weight");
                }
            }
        }
        #endregion

        #region ReasonDescription4Weight
        private string _ReasonDescription4Weight = string.Empty;
        /// <summary>
        /// Mức do quan trong
        /// </summary>
        [DataMember]
        public string ReasonDescription4Weight
        {
            get { return _ReasonDescription4Weight; }
            set
            {
                if (_ReasonDescription4Weight != value)
                {
                    _ReasonDescription4Weight = value;
                    SendPropertyChanged("ReasonDescription4Weight");
                }
            }
        }
        #endregion

        public int ImageHeight { get { return 20; } }
        public int ImageWidth { get { return 20; } }

        #region Quantity
        #region Quantity_Checked
        bool _Quantity_Checked = false;
        [DataMember]
        public bool Quantity_Checked
        {
            get { return _Quantity_Checked; }
            set
            {
                if (_Quantity_Checked != value)
                {
                    _Quantity_Checked = value;
                    SendPropertyChanged("Quantity_Checked");

                    if (_Quantity_Checked == false)
                    {
                        Quantity_Question = string.Empty;
                        Quantity_Answer = string.Empty;
                        Quantity_WeightPercent = null;
                    }
                }
            }
        }
        #endregion

        #region Quantity_Question
        string _Quantity_Question = string.Empty;
        [DataMember]
        public string Quantity_Question
        {
            get { return _Quantity_Question; }
            set
            {
                if (_Quantity_Question != value)
                {
                    _Quantity_Question = value;
                    SendPropertyChanged("Quantity_Question");
                }
            }
        }
        #endregion

        #region Quantity_WeightPercent
        int? _Quantity_WeightPercent = null;
        [DataMember]
        public int? Quantity_WeightPercent
        {
            get
            {
                if (_Quantity_WeightPercent.HasValue && _Quantity_WeightPercent < 0)
                    _Quantity_WeightPercent = 0;
                if (_Quantity_WeightPercent.HasValue && _Quantity_WeightPercent > 100)
                    _Quantity_WeightPercent = 100;
                return _Quantity_WeightPercent;
            }
            set
            {
                if (_Quantity_WeightPercent != value)
                {
                    _Quantity_WeightPercent = value;
                    if (_Quantity_WeightPercent.HasValue && _Quantity_WeightPercent < 0)
                        _Quantity_WeightPercent = 0;
                    if (_Quantity_WeightPercent.HasValue && _Quantity_WeightPercent > 100)
                        _Quantity_WeightPercent = 100;
                    SendPropertyChanged("Quantity_WeightPercent");
                    SendPropertyChanged("Quantity_Evaluation_Image");
                }
            }
        }
        #endregion

        #region Quantity_Evaluation_Image
        #region Quantity_Evaluation_Image_Sad
        static BitmapImage _Quantity_Evaluation_Image_Sad = null;
        static BitmapImage Quantity_Evaluation_Image_Sad
        {
            get
            {
                if (_Quantity_Evaluation_Image_Sad == null)
                {
                    _Quantity_Evaluation_Image_Sad = Quantity_Evaluation_Image_GetIt("1.png");
                }
                return _Quantity_Evaluation_Image_Sad;
            }
        }
        #endregion
        #region Quantity_Evaluation_Image_Normal
        static BitmapImage _Quantity_Evaluation_Image_Normal = null;
        static BitmapImage Quantity_Evaluation_Image_Normal
        {
            get
            {
                if (_Quantity_Evaluation_Image_Normal == null)
                {
                    _Quantity_Evaluation_Image_Normal = Quantity_Evaluation_Image_GetIt("2.png");
                }
                return _Quantity_Evaluation_Image_Normal;
            }
        }
        #endregion
        #region Quantity_Evaluation_Image_Happy
        static BitmapImage _Quantity_Evaluation_Image_Happy = null;
        static BitmapImage Quantity_Evaluation_Image_Happy
        {
            get
            {
                if (_Quantity_Evaluation_Image_Happy == null)
                {
                    _Quantity_Evaluation_Image_Happy = Quantity_Evaluation_Image_GetIt("3.png");
                }
                return _Quantity_Evaluation_Image_Happy;
            }
        }
        #endregion
        static BitmapImage Quantity_Evaluation_Image_GetIt(string aPath)
        {
            string path = System.IO.Path.Combine(FileFolder.AppInfo.AppDirectory, "Images/" + aPath);
            if (System.IO.File.Exists(path) == false)
            {
                Assergs.Windows.MessageBox.Show("Không tìm thấy file " + path);
                return null;
            }
            BitmapImage image = new BitmapImage();
            image.BeginInit();
            image.CacheOption = BitmapCacheOption.OnLoad;
            image.UriSource = new Uri(path);
            image.EndInit();

            return image;
        }
        public BitmapImage Quantity_Evaluation_Image
        {
            get
            {
                if (Quantity_WeightPercent == null)
                    return null;
                if (Quantity_WeightPercent <= VMConfig.Intance.TaskItem_Quantity_Image_Item.Level1)
                    return Quantity_Evaluation_Image_Sad;
                if (Quantity_WeightPercent <= VMConfig.Intance.TaskItem_Quantity_Image_Item.Level2)
                    return Quantity_Evaluation_Image_Normal;
                return Quantity_Evaluation_Image_Happy;
            }
        }
        #endregion
        #region Quantity_Answer
        string _Quantity_Answer = string.Empty;
        [DataMember]
        public string Quantity_Answer
        {
            get { return _Quantity_Answer; }
            set
            {
                if (_Quantity_Answer != value)
                {
                    _Quantity_Answer = value;
                    SendPropertyChanged("Quantity_Answer");
                }
            }
        }
        #endregion
        #endregion

        #region Quanlity
        #region Quanlity_Checked
        bool _Quanlity_Checked = false;
        [DataMember]
        public bool Quanlity_Checked
        {
            get { return _Quanlity_Checked; }
            set
            {
                if (_Quanlity_Checked != value)
                {
                    _Quanlity_Checked = value;
                    SendPropertyChanged("Quanlity_Checked");

                    if (_Quanlity_Checked == false)
                    {
                        Quanlity_Question = string.Empty;
                        Quanlity_Answer = string.Empty;
                        Quanlity_WeightPercent = null;
                    }
                }
            }
        }
        #endregion

        #region Quanlity_Question
        string _Quanlity_Question = string.Empty;
        [DataMember]
        public string Quanlity_Question
        {
            get { return _Quanlity_Question; }
            set
            {
                if (_Quanlity_Question != value)
                {
                    _Quanlity_Question = value;
                    SendPropertyChanged("Quanlity_Question");
                }
            }
        }
        #endregion

        #region Quanlity_WeightPercent
        int? _Quanlity_WeightPercent = null;
        [DataMember]
        public int? Quanlity_WeightPercent
        {
            get
            {
                if (_Quanlity_WeightPercent.HasValue && _Quanlity_WeightPercent < 0)
                    _Quanlity_WeightPercent = 0;
                if (_Quanlity_WeightPercent.HasValue && _Quanlity_WeightPercent > 100)
                    _Quanlity_WeightPercent = 100;
                return _Quanlity_WeightPercent;
            }
            set
            {
                if (_Quanlity_WeightPercent != value)
                {
                    _Quanlity_WeightPercent = value;
                    if (_Quanlity_WeightPercent.HasValue && _Quanlity_WeightPercent < 0)
                        _Quanlity_WeightPercent = 0;
                    if (_Quanlity_WeightPercent.HasValue && _Quanlity_WeightPercent > 100)
                        _Quanlity_WeightPercent = 100;
                    SendPropertyChanged("Quanlity_WeightPercent");
                    SendPropertyChanged("Quanlity_Evaluation_Image");
                }
            }
        }
        #endregion

        #region Quanlity_Evaluation_Image
        #region Quanlity_Evaluation_Image_Sad
        static BitmapImage _Quanlity_Evaluation_Image_Sad = null;
        static BitmapImage Quanlity_Evaluation_Image_Sad
        {
            get
            {
                if (_Quanlity_Evaluation_Image_Sad == null)
                {
                    _Quanlity_Evaluation_Image_Sad = Quanlity_Evaluation_Image_GetIt("1.png");
                }
                return _Quanlity_Evaluation_Image_Sad;
            }
        }
        #endregion
        #region Quanlity_Evaluation_Image_Normal
        static BitmapImage _Quanlity_Evaluation_Image_Normal = null;
        static BitmapImage Quanlity_Evaluation_Image_Normal
        {
            get
            {
                if (_Quanlity_Evaluation_Image_Normal == null)
                {
                    _Quanlity_Evaluation_Image_Normal = Quanlity_Evaluation_Image_GetIt("2.png");
                }
                return _Quanlity_Evaluation_Image_Normal;
            }
        }
        #endregion
        #region Quanlity_Evaluation_Image_Happy
        static BitmapImage _Quanlity_Evaluation_Image_Happy = null;
        static BitmapImage Quanlity_Evaluation_Image_Happy
        {
            get
            {
                if (_Quanlity_Evaluation_Image_Happy == null)
                {
                    _Quanlity_Evaluation_Image_Happy = Quanlity_Evaluation_Image_GetIt("3.png");
                }
                return _Quanlity_Evaluation_Image_Happy;
            }
        }
        #endregion
        static BitmapImage Quanlity_Evaluation_Image_GetIt(string aPath)
        {
            string path = System.IO.Path.Combine(FileFolder.AppInfo.AppDirectory, "Images/" + aPath);
            if (System.IO.File.Exists(path) == false)
            {
                Assergs.Windows.MessageBox.Show("Không tìm thấy file " + path);
                return null;
            }
            BitmapImage image = new BitmapImage();
            image.BeginInit();
            image.CacheOption = BitmapCacheOption.OnLoad;
            image.UriSource = new Uri(path);
            image.EndInit();

            return image;
        }
        public BitmapImage Quanlity_Evaluation_Image
        {
            get
            {
                if (Quanlity_WeightPercent == null)
                    return null;
                if (Quanlity_WeightPercent <= 30)
                    return Quanlity_Evaluation_Image_Sad;
                if (Quanlity_WeightPercent <= 80)
                    return Quanlity_Evaluation_Image_Normal;
                return Quanlity_Evaluation_Image_Happy;
            }
        }
        #endregion
        #region Quanlity_Answer
        string _Quanlity_Answer = string.Empty;
        [DataMember]
        public string Quanlity_Answer
        {
            get { return _Quanlity_Answer; }
            set
            {
                if (_Quanlity_Answer != value)
                {
                    _Quanlity_Answer = value;
                    SendPropertyChanged("Quanlity_Answer");
                }
            }
        }
        #endregion
        #endregion

        #region Systematic
        #region Systematic_Checked
        bool _Systematic_Checked = false;
        [DataMember]
        public bool Systematic_Checked
        {
            get { return _Systematic_Checked; }
            set
            {
                if (_Systematic_Checked != value)
                {
                    _Systematic_Checked = value;
                    SendPropertyChanged("Systematic_Checked");

                    if (_Systematic_Checked == false)
                    {
                        Systematic_Question = string.Empty;
                        Systematic_Answer = string.Empty;
                        Systematic_WeightPercent = null;
                    }
                }
            }
        }
        #endregion

        #region Systematic_Question
        string _Systematic_Question = string.Empty;
        [DataMember]
        public string Systematic_Question
        {
            get { return _Systematic_Question; }
            set
            {
                if (_Systematic_Question != value)
                {
                    _Systematic_Question = value;
                    SendPropertyChanged("Systematic_Question");
                }
            }
        }
        #endregion

        #region Systematic_WeightPercent
        int? _Systematic_WeightPercent = null;
        [DataMember]
        public int? Systematic_WeightPercent
        {
            get
            {
                if (_Systematic_WeightPercent.HasValue && _Systematic_WeightPercent < 0)
                    _Systematic_WeightPercent = 0;
                if (_Systematic_WeightPercent.HasValue && _Systematic_WeightPercent > 100)
                    _Systematic_WeightPercent = 100;
                return _Systematic_WeightPercent;
            }
            set
            {
                if (_Systematic_WeightPercent != value)
                {
                    _Systematic_WeightPercent = value;
                    if (_Systematic_WeightPercent.HasValue && _Systematic_WeightPercent < 0)
                        _Systematic_WeightPercent = 0;
                    if (_Systematic_WeightPercent.HasValue && _Systematic_WeightPercent > 100)
                        _Systematic_WeightPercent = 100;
                    SendPropertyChanged("Systematic_WeightPercent");
                    SendPropertyChanged("Systematic_Evaluation_Image");
                }
            }
        }
        #endregion

        #region Systematic_Evaluation_Image
        #region Systematic_Evaluation_Image_Sad
        static BitmapImage _Systematic_Evaluation_Image_Sad = null;
        static BitmapImage Systematic_Evaluation_Image_Sad
        {
            get
            {
                if (_Systematic_Evaluation_Image_Sad == null)
                {
                    _Systematic_Evaluation_Image_Sad = Systematic_Evaluation_Image_GetIt("1.png");
                }
                return _Systematic_Evaluation_Image_Sad;
            }
        }
        #endregion
        #region Systematic_Evaluation_Image_Normal
        static BitmapImage _Systematic_Evaluation_Image_Normal = null;
        static BitmapImage Systematic_Evaluation_Image_Normal
        {
            get
            {
                if (_Systematic_Evaluation_Image_Normal == null)
                {
                    _Systematic_Evaluation_Image_Normal = Systematic_Evaluation_Image_GetIt("2.png");
                }
                return _Systematic_Evaluation_Image_Normal;
            }
        }
        #endregion
        #region Systematic_Evaluation_Image_Happy
        static BitmapImage _Systematic_Evaluation_Image_Happy = null;
        static BitmapImage Systematic_Evaluation_Image_Happy
        {
            get
            {
                if (_Systematic_Evaluation_Image_Happy == null)
                {
                    _Systematic_Evaluation_Image_Happy = Systematic_Evaluation_Image_GetIt("3.png");
                }
                return _Systematic_Evaluation_Image_Happy;
            }
        }
        #endregion
        static BitmapImage Systematic_Evaluation_Image_GetIt(string aPath)
        {
            string path = System.IO.Path.Combine(FileFolder.AppInfo.AppDirectory, "Images/" + aPath);
            if (System.IO.File.Exists(path) == false)
            {
                Assergs.Windows.MessageBox.Show("Không tìm thấy file " + path);
                return null;
            }
            BitmapImage image = new BitmapImage();
            image.BeginInit();
            image.CacheOption = BitmapCacheOption.OnLoad;
            image.UriSource = new Uri(path);
            image.EndInit();

            return image;
        }
        public BitmapImage Systematic_Evaluation_Image
        {
            get
            {
                if (Systematic_WeightPercent == null)
                    return null;
                if (Systematic_WeightPercent <= 30)
                    return Systematic_Evaluation_Image_Sad;
                if (Systematic_WeightPercent <= 80)
                    return Systematic_Evaluation_Image_Normal;
                return Systematic_Evaluation_Image_Happy;
            }
        }
        #endregion
        #region Systematic_Answer
        string _Systematic_Answer = string.Empty;
        [DataMember]
        public string Systematic_Answer
        {
            get { return _Systematic_Answer; }
            set
            {
                if (_Systematic_Answer != value)
                {
                    _Systematic_Answer = value;
                    SendPropertyChanged("Systematic_Answer");
                }
            }
        }
        #endregion
        #endregion
    }

    public class PercentRangeRule : ValidationRule
    {
        private int _min;
        private int _max;

        public PercentRangeRule()
        {
        }

        public int Min
        {
            get { return _min; }
            set { _min = value; }
        }

        public int Max
        {
            get { return _max; }
            set { _max = value; }
        }

        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            int age = 0;

            try
            {
                if (((string)value).Length > 0)
                    age = Int32.Parse((String)value);
            }
            catch (Exception e)
            {
                return new ValidationResult(false, "Illegal characters or " + e.Message);
            }

            if ((age < Min) || (age > Max))
            {
                return new ValidationResult(false,
                  "Please enter an age in the range: " + Min + " - " + Max + ".");
            }
            else
            {
                return new ValidationResult(true, null);
            }
        }
    }
}
